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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 IF NOT EXISTS INSERT INTO Linked Server

Author  Topic 

Jeynesy
Starting Member

2 Posts

Posted - 2015-01-02 : 18:37:02
Hi - I am have linked servers and I am trying to do a basic synchronisation between a local SQL 2005 express and a remote SQL 2005 Server using an - IF NOT EXISTS INSERT INTO Statement. Something like...

If Not Exists(SELECT * FROM [109.203.122.211,XXXXX].ShelfLifeTacker.dbo.tblProducts)
Begin
insert into [109.203.122.211,XXXXX].ShelfLifeTacker.dbo.tblProducts
select *
from tblProducts
End

I get 'Command(s) completed successfully' - but no data is inserted.

Apologies if this is glaringly obvious. Thanks in advance for any advice

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2015-01-03 : 08:58:25
check if this

SELECT * FROM [109.203.122.211,XXXXX].ShelfLifeTacker.dbo.tblProducts

gives any output


Too old to Rock'n'Roll too young to die.
Go to Top of Page
   

- Advertisement -