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
 General SQL Server Forums
 New to SQL Server Programming
 Deleting data from linked server table

Author  Topic 

insanepaul
Posting Yak Master

178 Posts

Posted - 2008-11-13 : 09:45:39
Hi,
I can successfully delete data from linked server tables using a simple delete command eg:

delete * from serveraliasname.sm.dbo.strtrig

I can select data from the linked server tables using a more complicated string:

select * from serveraliasname.sm.dbo.strtrig where striggerguid in (select striggerguid from serveraliasname.sm.dbo.strtrig where stoolguid = '{dfgd1fg2dfg3dfgd3fg}')

BUT when I try to use the same command using a 'delete' instead of a 'select *', I get an error:

OLE DB provider "SQLNCLI" for linked server "serveraliasname" returned message "Multiple-step OLE DB operation generated errors.

I've looked into this error but having no joy.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-11-13 : 10:06:34
quote:
Originally posted by insanepaul

Hi,
I can successfully delete data from linked server tables using a simple delete command eg:

delete * from serveraliasname.sm.dbo.strtrig

I can select data from the linked server tables using a more complicated string:

select * from serveraliasname.sm.dbo.strtrig where striggerguid in (select striggerguid from serveraliasname.sm.dbo.strtrig where stoolguid = '{dfgd1fg2dfg3dfgd3fg}')

BUT when I try to use the same command using a 'delete' instead of a 'select *', I get an error:

OLE DB provider "SQLNCLI" for linked server "serveraliasname" returned message "Multiple-step OLE DB operation generated errors.

I've looked into this error but having no joy.




you dont require * in delete
Go to Top of Page

insanepaul
Posting Yak Master

178 Posts

Posted - 2008-11-13 : 10:14:32
quote:
Originally posted by visakh16

quote:
Originally posted by insanepaul

Hi,
I can successfully delete data from linked server tables using a simple delete command eg:

delete * from serveraliasname.sm.dbo.strtrig

I can select data from the linked server tables using a more complicated string:

select * from serveraliasname.sm.dbo.strtrig where striggerguid in (select striggerguid from serveraliasname.sm.dbo.strtrig where stoolguid = '{dfgd1fg2dfg3dfgd3fg}')

BUT when I try to use the same command using a 'delete' instead of a 'select *', I get an error:

OLE DB provider "SQLNCLI" for linked server "serveraliasname" returned message "Multiple-step OLE DB operation generated errors.

I've looked into this error but having no joy.




you dont require * in delete


I guessed that I didn't make myself clear enough...I used:

delete from serveraliasname.sm.dbo.strtrig where striggerguid in (select striggerguid from serveraliasname.sm.dbo.strtrig where stoolguid = '{dfgd1fg2dfg3dfgd3fg}')

I've tested all sorts of things. For example I successfully deleted the data on the local table using this statement without the linked server (as expected) and then remotely used the used sql analyser to delete the data from the remote server.

I just can't delete using a linked server with the 'in' statement. I wondered if this was normal. Am I clear?
Go to Top of Page

insanepaul
Posting Yak Master

178 Posts

Posted - 2008-11-13 : 11:26:58
quote:
Originally posted by insanepaul

quote:
Originally posted by visakh16

quote:
Originally posted by insanepaul

Hi,
I can successfully delete data from linked server tables using a simple delete command eg:

delete * from serveraliasname.sm.dbo.strtrig

I can select data from the linked server tables using a more complicated string:

select * from serveraliasname.sm.dbo.strtrig where striggerguid in (select striggerguid from serveraliasname.sm.dbo.strtrig where stoolguid = '{dfgd1fg2dfg3dfgd3fg}')

BUT when I try to use the same command using a 'delete' instead of a 'select *', I get an error:

OLE DB provider "SQLNCLI" for linked server "serveraliasname" returned message "Multiple-step OLE DB operation generated errors.

I've looked into this error but having no joy.




you dont require * in delete


I guessed that I didn't make myself clear enough...I used:

delete from serveraliasname.sm.dbo.strtrig where striggerguid in (select striggerguid from serveraliasname.sm.dbo.strtrig where stoolguid = '{dfgd1fg2dfg3dfgd3fg}')

I've tested all sorts of things. For example I successfully deleted the data on the local table using this statement without the linked server (as expected) and then remotely used the used sql analyser to delete the data from the remote server.

I just can't delete using a linked server with the 'in' statement. I wondered if this was normal. Am I clear?



I still need some help please
Go to Top of Page
   

- Advertisement -