22 May,2019 by Tom Collins
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 is only a preview. Your comment has not yet been posted.
As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.
Having trouble reading this image? View an alternate.
Posted by: |