Monthly Archives: May 2008

Linked server and XML

If you call a stored procedure in a linked server to return xml, you may not get what you expected.Let’s define a linked server first: exec sp_addlinkedserver ‘MyServer’, ”, N‘SQLOLEDB’, ‘MyRemoteServer’, ”,”,‘Northwind’ exec sp_addlinkedsrvlogin @rmtsrvname = ‘MyServer’, @useself = ‘true’ … Continue reading

Posted in SQL server | 2 Comments

Return all nodes in an XML between two nodes

This is from a post (http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=3272546&SiteID=1) asking for getting all nodes between 2 nodes in the xml. Michael Rys suggested using >> and << as the node order comparison. The following is the code:  declare @x xml; set @x = N‘<Contents> text … Continue reading

Posted in XML, XQuery and XPath | Leave a comment