hi friends,
whats the command used to bulk copy all the tables from the database?
pls help me to solve this.
thanks
vanithaVantha,
If you have both the source and target database on the same server you can
generate INSERT INTO tbl SELECT * FROM <SOURCE DB>.TABLE statments to copy
all the data.
try this query for generating required INSERT statements automatically.(run
this query on your destination query)
SELECT 'INSERT INTO ' + NAME + ' SELECT * FROM <YOUR_SOURCE_DATABASE>.DBO.'+
NAME
FROM SYSOBJECTS WHERE TYPE ='U'
If you source and destination servers are differnt, please create linked
servers and modify the aboove statment to include linked server name in the
SELECT statement.
Regards,
Gopinath M
"Vanitha" wrote:
> hi friends,
> whats the command used to bulk copy all the tables from the database?
> pls help me to solve this.
> thanks
> vanitha|||Gopinath M wrote:
> Vantha,
> If you have both the source and target database on the same server
> you can generate INSERT INTO tbl SELECT * FROM <SOURCE DB>.TABLE
> statments to copy all the data.
> try this query for generating required INSERT statements
> automatically.(run this query on your destination query)
> SELECT 'INSERT INTO ' + NAME + ' SELECT * FROM
> <YOUR_SOURCE_DATABASE>.DBO.'+ NAME
> FROM SYSOBJECTS WHERE TYPE ='U'
> If you source and destination servers are differnt, please create
> linked servers and modify the aboove statment to include linked
> server name in the SELECT statement.
Alternatively use DTS to copy data.
robert
没有评论:
发表评论