Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
ConradK
Posting Yak Master
140 Posts |
Posted - 2011-01-03 : 10:22:56
|
| So I'm using the sp_addlinkedserver function, and then selecting from that added server, and then dropping that added server.My code is this:execsp_addlinkedserver 'Diva' ,'ims-server1' ,'SQLNCLI' ,'IMS-SERVER1' select * from diva.divadb.dbo.items exec sp_dropserver @server = 'Diva'It works if I do each part one at a time, but if I just open and run it, epic fail. Im sure this has to do with procedure, I've tried using ';'s and go and such, but I am fail with them. Can please help? |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2011-01-03 : 10:29:37
|
| How about adding it just once and never dropping it? |
 |
|
|
SparkByte
Yak Posting Veteran
60 Posts |
Posted - 2011-01-03 : 10:53:55
|
| How aboutexecsp_addlinkedserver 'Diva','ims-server1','SQLNCLI' ,'IMS-SERVER1'GOselect*fromdiva.divadb.dbo.itemsGOexecsp_dropserver @server = 'Diva'UNTESTED (I do not have linked Servers.)Thank You,John |
 |
|
|
ConradK
Posting Yak Master
140 Posts |
Posted - 2011-01-03 : 11:06:50
|
| Works, thanks! |
 |
|
|
|
|
|
|
|