Thursday, 15 September 2011

sql - Transfer a table from a server to another server -



sql - Transfer a table from a server to another server -

besides import , export wizard, there query transfer table server server in sql server 2008?

select * [server1].[db_name].[dbo].[table_name] [server2].[db_name].[dbo].[table_name]

there several options. if have right permissions, can create linked server next instructions here: http://msdn.microsoft.com/en-us/library/ff772782.aspx

and utilize openquery (http://msdn.microsoft.com/en-us/library/ms188427.aspx) select records:

select * new_db.new_schema.new_table openquery(linked_server_name, 'select * old_db.old_schema.old_table');

or can similar openrowset (http://technet.microsoft.com/en-us/library/ms190312.aspx) if don't want go through setting linked server:

select * new_db.new_schema.new_table openrowset('sqlncli', 'server=oldserver;trusted_connection=yes;', 'select * old_db.old_schema.old_table');

both may require tweaking based on authentication method you're using, usernames, privileges, , that.

sql sql-server sql-server-2008 tsql

No comments:

Post a Comment