• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 552
  • Last Modified:

MS SQL 2005 - compare @XML to schema collection

Hi Expert,

I would like to create a SQL store procedure that insert XML data in a XML column.

But the table will contain many different type of XML (Many different Schema).

How Can I used the Schema collection to validate the XML data before inserting it?

Something like this:
create proc XML_INS
	@xml_data xml
	, @vchSchemaName varchar(100)

if @xml_data is conform to SCHEMA COLLECTION @vchSchemaName 
 -- insert 
 -- raiseerror()

Open in new window

1 Solution
CboudrozAuthor Commented:
Thanks for the links,

I find out that the best way was to Create temp table whit XML column link to a XML schema and do a insert inside of a TRY CATCH Block, if error schema is not valid.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Build your data science skills into a career

Are you ready to take your data science career to the next step, or break into data science? With Springboard’s Data Science Career Track, you’ll master data science topics, have personalized career guidance, weekly calls with a data science expert, and a job guarantee.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now