August 3, 2012 at 6:23 am
DECLARE @Employee AS Table (SlNo INT,Name VARCHAR(500),Salary MONEY)
DECLARE @XML AS xml
DECLARE @IDoc INT
SET @XML = NULL
INSERT INTO @Employee values(1,'Antony',10000)
INSERT INTO @Employee values(2,'Agent',40000)
INSERT INTO @Employee values(3,'Master',50000)
SET @XML = (SELECT SlNo,Name,Salary FROM @Employee Emp FOR XML Auto, Root('COMPANY'),elements)
Exec Sp_Xml_PrepareDocument @IDoc Output, @XML
SELECT SlNo,Name,Salary FROM OpenXMl (@iDoc,'/Company/Emp',2)
WITH(SlNo INT,Name VARCHAR(500),Salary MONEY)
EXEC sp_xml_removedocument @IDoc
When i selecting , it returns no row. Why ? Plse Help me...
August 3, 2012 at 6:26 am
Thats the QotD from Wednesday.
Have you answered the question yet? If so it tells you why you get no results.
August 3, 2012 at 7:30 am
*it's somewhere in the OpenXML statement*
:pinch:
MCITP: Database Administrator 2005
MCTS SQL Server 2008
MCP SQL 2012/2014
MCSA SQL Server 2012/2014
MCSE Data Management and Analytics
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy