Thanks for the reply.
But you I can't apply your solutions to my problem because
[A] - INSERT INTO SELECT can only used after creating the new table. I need
to create a new table with the same structure too (on the fly) and that's
where I got stuck.
[B] - I can't depend on SQL DMO or SQL DBLib because my application should
run with minimum system requirements. I'm even targeting XP,Me and 98
Let me know if you have any more suggestions.
"SriSamp" <ssampathsct.co.in> wrote in message
news:Obhy%23GSQDHA.1552TK2MSFTNGP10.phx.gbl...SELECT> There are two options you can try:
> [A] You can copy over a table very easily by using a statement like:ADO> * INT new_authors FROM authors WHERE 1 = 0. To copy over the indexes, you
> can play around with the sysindexes table and issue ALTER TABLE commands.
> [B] Use SQLDMO to script out the table and then re-run the script using a
> new table name. SQLDMO is a COM library that you can access.
> Please reply to the whole group only!
> "Sudaraka Wijesinghe" <sudarakaidnw.com> wrote in message
> news:uU6S5CSQDHA.704tk2msftngp13.phx.gbl...> > Hi,
> > I need to copy an entire table on MS SQL DB, along with all indexes and
> > primary key. And I need to do this from an VC++ application that usesADO> to> > connect to the Server. Table structure may vary. I'm restricted to use>> > only so it'll have to be a T-SQL.
> > any suggestions?
> > Thanks.
> > --
> > Sudaraka Wijesinghe.
> > iDial Networks Inc.
> > [sudarakaidnw.com]