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 2000 Forums
 SQL Server Development (2000)
 delete query

Author  Topic 

yakoo
Constraint Violating Yak Guru

312 Posts

Posted - 2001-11-06 : 14:30:04
I have the following query that returns the record that I want to delete from a database table.


SELECT a.* FROM LOM_INFLO.bpSQL_INFLO.dbo.Advertisers a where NOT EXISTS(SELECT AdvertiserID FROM Advertisers a2 where a.AdvertiserID=a2.AdvertiserID)


I tried converting this to a delete statment but it fails on me

DELETE FROM LOM_INFLO.bpSQL_INFLO.dbo.Advertisers a where NOT EXISTS(SELECT AdvertiserID FROM Advertisers a2 where a.AdvertiserID=a2.AdvertiserID)


Can anybody point out what I am doing wrong.


basically Im trying to delete records from one table on a linked server that doesnt exist in the primary table.

I also tried

DELETE LOM_INFLO.bpSQL_INFLO.dbo.Advertisers where NOT EXISTS(SELECT AdvertiserID FROM Advertisers a2 where LOM_INFLO.bpSQL_INFLO.dbo.Advertisers.AdvertiserID=a2.AdvertiserID)

but I get the following error:
The number name 'LOM_INFLO.bpSQL_INFLO.dbo.Advertisers' contains more than the maximum number of prefixes. The maximum is 3.



Edited by - yakoo on 11/06/2001 14:32:33

Edited by - yakoo on 11/06/2001 14:33:42
   

- Advertisement -