Click here to Skip to main content
15,914,160 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
Hi all,
i have tried to execute xmlnamespace in the below storedprocedure,
but its saying that ,
Incorrect syntax near 'XMLNAMESPACES'.


My code is :

INSERT #BrandData
			WITH XMLNAMESPACES('http://mch.com/IF002/SD/mch/I_mch' as ns0)
			SELECT	
					Data.value('(nickname/text())[1]','VARCHAR(100)') AS nickname,
					Data.value('(username/text())[1]','VARCHAR(100)') AS username,
					Data.value('(IsActive/text())[1]','VARCHAR(4)') AS IsActive
				
			FROM     
					@xmldoc.nodes('//ns0:mch_In/Data')AS BrandData (Data)


please drop me a solution for this


What I have tried:

how to execute xmlnamespace in storedprocedure?
Posted
Updated 10-Jul-16 22:12pm

1 solution

I haven't worked much on this but I belive your order statement is wrong. It should something like following-

SQL
WITH XMLNAMESPACES('http://mch.com/IF002/SD/mch/I_mch' as ns0)
            INSERT #BrandData
SELECT
        Data.value('(nickname/text())[1]','VARCHAR(100)') AS nickname,
        Data.value('(username/text())[1]','VARCHAR(100)') AS username,
        Data.value('(IsActive/text())[1]','VARCHAR(4)') AS IsActive

FROM
        @xmldoc.nodes('//ns0:mch_In/Data')AS BrandData (Data)


Please try and let me know if you still have issues. :)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900