I want to insert rows from a table in a server
into another table in another server using
INSERT SELECT command. For example :
INSERT INTO Server1.database1.dbo.Tab1
SELECT * FROM Server2.database2.dbo.Tab1
WHERE Col1 = 1
Can the command like this work ?
If not, could you give me the solution ?
Please help me
Thanks in advance
John Smile
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!You have the correct syntax. Assuming you have created a linked server on
the server where you run the code and provided you have the required
permissions then your INSERT statement looks OK. See the Linked Servers
topic in Books Online for details.
BUT, don't use SELECT * in production code and always list the target column
names in an INSERT statement. Following those good practices should make
your code easier to maintain if your table structures change.
--
David Portas
SQL Server MVP
--|||Hi David,
Thank you for your reply.
Currently I have 2 servers that work as domain
controller and member server. Both of them run
SQL Server. My command works on the member server
and does not work on domain controller (DC).
The DC can not see the member server
and clients. It means when I open a client path
in my network places (using server windows explorer),
I get an error (\\Client is not accessible).
But the member server and clients can see the DC
and they also able to see them each other.
I think there is something wrong in my windows
setting that causes the command does not work on
the DC. If you do not mind, could you show me
what setting that cause this problem ?
John Smile
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!|||Hi David,
Thank you for your reply.
Currently I have 2 servers that work as domain
controller and member server. Both of them run
SQL Server. My command works on the member server
and does not work on domain controller (DC).
The DC can not see the member server
and clients. It means when I open a client path
in my network places (using server windows explorer),
I get an error (\\Client is not accessible).
But the member server and clients can see the DC
and they also able to see them each other.
I think there is something wrong in my windows
setting that causes the command does not work on
the DC. If you do not mind, could you show me
what setting that cause this problem ?
John Smile
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
No comments:
Post a Comment