llewis Posted October 14, 2015 Share Posted October 14, 2015 Please help! I am new to implementing xml within SQL. I'm trying to create a stored procedure that creates an xml node when a user enters data within my website. Below is a sample of my stored procedure. I have tried to declare the namespace within the insert however I continue to receive the "undeclared prefix" error message. Code: DECLARE @Term XML = '<wma:Term>My First Term</wma:Term>'DECLARE @x XML SELECT @x = MetaDataFROM [Products] WHERE ID = 1SET @x.modify ('declare namespace wma="http://www.google.com/wma"; insert sql:variable("@Term") as last into (/wma:WMA/wma:List)[1] Expected results: <wma:WMA xmlns:wma="http://www.google.com/wma"> <wma:List> <wma:Term>My First Term</wma:Term> </wma:List></wma:WMA> Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now