Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Should be an easy linked server (delete command) question 1

Status
Not open for further replies.

hoggle

Programmer
Jul 13, 2001
124
US
I have working linked server (ie I can pull data from it). The problem I'm running into is when I'm trying to execute a delete command, basically I want to delete any records on server2(SO_90), where the id is in another table on server1(tempE).

here's my (incorrect syntax)
DELETE FROM SERVER2.QueryTrx.dbo.SO_90
WHERE EXISTS(
SELECT * FROM tempE
WHERE SERVER2.QueryTrx.dbo.SO_90.SalesOrderNumber=tempE.SalesOrderNumber
)

the error I keep getting is:
Server: Msg 117, Level 15, State 2, Line 4
The number name 'SERVER2.QueryTrx.dbo.SO_90' contains more than the maximum number of prefixes. The maximum is 3.

I've been fighting all morning with this, thanks for any help :D
 
Try this (execute on Server1):

Code:
DELETE server2.querytrx.dbo.so_90
FROM server2.querytrx.dbo.so_90 t1 JOIN tempe t2 ON t1.salesordernumber = t2.salesordernumber

--James
 
Thanks so much, works like a champ :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top