﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2008 / SQL Server 2008 - General  / Merge statement with openrowset / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Wed, 19 Jun 2013 04:54:33 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Merge statement with openrowset</title><link>http://www.sqlservercentral.com/Forums/Topic1417479-391-1.aspx</link><description>Sorry for replying late. I am connected to MYSERVER while running the openrowset</description><pubDate>Thu, 14 Feb 2013 05:28:20 GMT</pubDate><dc:creator>S_Kumar_S</dc:creator></item><item><title>RE: Merge statement with openrowset</title><link>http://www.sqlservercentral.com/Forums/Topic1417479-391-1.aspx</link><description>[quote][b]S_Kumar_S (2/8/2013)[/b][hr]HI AllIs it possible to run the MERGE statement using Openrowset or openquery? I tried with below statement:[/quote]You want to run this MERGE as a remote query on SERVER=MYSERVER. The MERGE uses a linked server (SERVERXYZ) table as a source. What server are you connected to when you run the openrowset query?</description><pubDate>Fri, 08 Feb 2013 04:10:15 GMT</pubDate><dc:creator>ChrisM@Work</dc:creator></item><item><title>RE: Merge statement with openrowset</title><link>http://www.sqlservercentral.com/Forums/Topic1417479-391-1.aspx</link><description>BOL states that OpenRowSet can be used as a Target in the merge but appears to be ambiguous as to whether it can be a source. Have you tried loading the data from the openrowset into a temp table then use that as the merge, another alternative could be to use a CTE to do the OpenRowSet load, but It may cause a bottleneck.</description><pubDate>Fri, 08 Feb 2013 03:29:42 GMT</pubDate><dc:creator>Jason-299789</dc:creator></item><item><title>RE: Merge statement with openrowset</title><link>http://www.sqlservercentral.com/Forums/Topic1417479-391-1.aspx</link><description>yes, permissions are there. If i run the merge statement without OPENROWSET, it works.So i was querious if it is possible at all?</description><pubDate>Fri, 08 Feb 2013 03:07:10 GMT</pubDate><dc:creator>S_Kumar_S</dc:creator></item><item><title>RE: Merge statement with openrowset</title><link>http://www.sqlservercentral.com/Forums/Topic1417479-391-1.aspx</link><description>Please check if you have the necessary permission to perform INSERT/UPDATE/DELETE operation on the target table.</description><pubDate>Fri, 08 Feb 2013 00:24:21 GMT</pubDate><dc:creator>arun1_m1</dc:creator></item><item><title>Merge statement with openrowset</title><link>http://www.sqlservercentral.com/Forums/Topic1417479-391-1.aspx</link><description>HI AllIs it possible to run the MERGE statement using Openrowset or openquery? I tried with below statement:SELECT *FROM OPENROWSET('SQLNCLI',   'DRIVER={SQL Server};SERVER=MYSERVER;UID=sa;PWD=mypwd',   'MERGE dbo.tab1 AS a USING (SELECT * FROM [SERVERXYZ].MyDB.dbo.tab1  with (nolock)) AS bON a.Id=b.idWHEN MATCHED THEN UPDATE SET a.ID=b.idWHEN NOT MATCHED BY TARGET THENINSERT(id)VALUES(b.id)WHEN NOT MATCHED BY SOURCE THEN DELETE;')  [b]but got error:[/b]Msg 7357, Level 16, State 2, Line 1Cannot process the object "MERGE dbo.tab1 AS a USING (SELECT * FROM [SERVER2].DotnetNuke2.dbo.tab1  with (nolock)) AS bON a.Id=b.idWHEN MATCHED THEN UPDATE SET a.ID=b.idWHEN NOT MATCHED BY TARGET THENINSERT(id)VALUES(b.id)WHEN NOT MATCHED BY SOURCE THEN DELETE;". The OLE DB provider "SQLNCLI10" for linked server "(null)" indicates that either the object has no columns or the current user does not have permissions on that object.</description><pubDate>Fri, 08 Feb 2013 00:16:04 GMT</pubDate><dc:creator>S_Kumar_S</dc:creator></item></channel></rss>