I was thinking about using bcp command to solve the user authentication, but does a bcp command capable to import to a table in my database? By the way, I am using SQL Server 2000 environment.
Here’s the code I have got so far:
SET @Command = ‘bcp “SELECT vwTest.* from [myserver\sql].test.dbo.vwTest” queryout dbo.Test -C ACP -c -r \n -t “;” -S myserver\sql -Umyuser -Puser1’
EXEC master.dbo.xp_cmdshell @Command
Based on the comparison of BCP, BULK INSERT, OPENROWSET (infer Linked Server) here:
…bcp possibly isn’t the most efficient means of transferring data. You might be better off to:
INSERTstatements, so that the tables are populated based on records from the database exposed in the linked server instance.Besides potentially being more efficient, you only need to setup the linked server instance once versus running BCP to create output scripts every time you want to move data.
Mind that the linked server instance is based on a user on the other database, so permissions to the other database are based on that users’ permissions.