Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

DELETE FROM OPENQUERY

Question: How can I Delete using OPENQUERY?   Normally for a SELECT from OPENQUERY , I'll do something like :

SELECT col1 ,col2  FROM OPENQUERY (MY_LINKED_SERVER,'SELECT col1,col2  FROM MY_LINKED_TABLE') 

Can a similar method be used but for DELETE?

Answer: To use DELETE , it's a similar process to the SELECT but using the DELETE syntax. Taking the SELECT example above - you'll do the following. Note:this example will delete ALL the rows in the  linked server table .  :

DELETE FROM OPENQUERY (MY_LINKED_SERVER,'SELECT col1,col2  FROM MY_LINKED_TABLE')

Read more on OPENQUERY,Linked Servers and AS400

SQL Server – Datetime date range , AS400 and OPENQUERY (SQL ...

Connect SQL Servers without using Linked Servers

Import Data from AS400 to SQL Server



This post first appeared on SQLSERVER-DBA.com, please read the originial post: here

Share the post

DELETE FROM OPENQUERY

×

Subscribe to Sqlserver-dba.com

Get updates delivered right to your inbox!

Thank you for your subscription

×