<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: SQL SERVER &#8211; Validate an XML document in TSQL using XSD by Jacob Sebastian</title>
	<atom:link href="http://blog.sqlauthority.com/2009/12/02/sql-server-validate-an-xml-document-in-tsql-using-xsd-by-jacob-sebastian/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sqlauthority.com/2009/12/02/sql-server-validate-an-xml-document-in-tsql-using-xsd-by-jacob-sebastian/</link>
	<description>Personal Notes of Pinal Dave</description>
	<lastBuildDate>Fri, 17 May 2013 15:26:57 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: SQL SERVER &#8211; Weekly Series &#8211; Memory Lane &#8211; #006 &#171; SQL Server Journey with SQL Authority</title>
		<link>http://blog.sqlauthority.com/2009/12/02/sql-server-validate-an-xml-document-in-tsql-using-xsd-by-jacob-sebastian/#comment-389242</link>
		<dc:creator><![CDATA[SQL SERVER &#8211; Weekly Series &#8211; Memory Lane &#8211; #006 &#171; SQL Server Journey with SQL Authority]]></dc:creator>
		<pubDate>Sat, 08 Dec 2012 01:30:59 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=7505#comment-389242</guid>
		<description><![CDATA[[...] Validate an XML document in TSQL using XSD My friend Jacob Sebastian wrote an excellent article on the subject XML and XSD. Because of the ‘eXtensible’ nature of XML (eXtensible Markup Language), often there is a requirement to restrict and validate the content of an XML document to a pre-defined structure and values. XSD (XML Schema Definition Language) is the W3C recommended language for describing and validating XML documents. SQL Server implements XSD as XML Schema Collections. [...]]]></description>
		<content:encoded><![CDATA[<p>[...] Validate an XML document in TSQL using XSD My friend Jacob Sebastian wrote an excellent article on the subject XML and XSD. Because of the ‘eXtensible’ nature of XML (eXtensible Markup Language), often there is a requirement to restrict and validate the content of an XML document to a pre-defined structure and values. XSD (XML Schema Definition Language) is the W3C recommended language for describing and validating XML documents. SQL Server implements XSD as XML Schema Collections. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anirudh Sriram</title>
		<link>http://blog.sqlauthority.com/2009/12/02/sql-server-validate-an-xml-document-in-tsql-using-xsd-by-jacob-sebastian/#comment-303776</link>
		<dc:creator><![CDATA[Anirudh Sriram]]></dc:creator>
		<pubDate>Thu, 21 Jun 2012 04:26:40 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=7505#comment-303776</guid>
		<description><![CDATA[Brilliant! Thanks a tonne!]]></description>
		<content:encoded><![CDATA[<p>Brilliant! Thanks a tonne!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: yobikwhatus</title>
		<link>http://blog.sqlauthority.com/2009/12/02/sql-server-validate-an-xml-document-in-tsql-using-xsd-by-jacob-sebastian/#comment-253403</link>
		<dc:creator><![CDATA[yobikwhatus]]></dc:creator>
		<pubDate>Fri, 17 Feb 2012 05:32:09 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=7505#comment-253403</guid>
		<description><![CDATA[Do you have a way to generate SQL tables from XML Schema Collections?]]></description>
		<content:encoded><![CDATA[<p>Do you have a way to generate SQL tables from XML Schema Collections?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SQL SERVER &#8211; Methods for Accessing SQL Server XML Datatype &#8211; Quiz &#8211; Puzzle &#8211; 20 of 31 &#171; SQL Server Journey with SQL Authority</title>
		<link>http://blog.sqlauthority.com/2009/12/02/sql-server-validate-an-xml-document-in-tsql-using-xsd-by-jacob-sebastian/#comment-241553</link>
		<dc:creator><![CDATA[SQL SERVER &#8211; Methods for Accessing SQL Server XML Datatype &#8211; Quiz &#8211; Puzzle &#8211; 20 of 31 &#171; SQL Server Journey with SQL Authority]]></dc:creator>
		<pubDate>Sat, 21 Jan 2012 01:31:41 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=7505#comment-241553</guid>
		<description><![CDATA[[...] Interview Questions and Answers ISBN: 1466405643 Page#137-139 SELECT * FROM XML Shredding XML Validate an XML document in TSQL using XSD Simple Example of Reading XML File Using T-SQL Simple Example of Creating XML File Using [...]]]></description>
		<content:encoded><![CDATA[<p>[...] Interview Questions and Answers ISBN: 1466405643 Page#137-139 SELECT * FROM XML Shredding XML Validate an XML document in TSQL using XSD Simple Example of Reading XML File Using T-SQL Simple Example of Creating XML File Using [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: NickyD</title>
		<link>http://blog.sqlauthority.com/2009/12/02/sql-server-validate-an-xml-document-in-tsql-using-xsd-by-jacob-sebastian/#comment-155889</link>
		<dc:creator><![CDATA[NickyD]]></dc:creator>
		<pubDate>Wed, 10 Aug 2011 19:49:07 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=7505#comment-155889</guid>
		<description><![CDATA[Very concise and useful. Thanks Pinal and Jacob.]]></description>
		<content:encoded><![CDATA[<p>Very concise and useful. Thanks Pinal and Jacob.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: poorna</title>
		<link>http://blog.sqlauthority.com/2009/12/02/sql-server-validate-an-xml-document-in-tsql-using-xsd-by-jacob-sebastian/#comment-150572</link>
		<dc:creator><![CDATA[poorna]]></dc:creator>
		<pubDate>Mon, 25 Jul 2011 13:49:55 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=7505#comment-150572</guid>
		<description><![CDATA[Hi,
Im poorna. Can any one please let me know how to get alla error messages at once while validating xml with xsd in sql2008?
thank a lot in advance.]]></description>
		<content:encoded><![CDATA[<p>Hi,<br />
Im poorna. Can any one please let me know how to get alla error messages at once while validating xml with xsd in sql2008?<br />
thank a lot in advance.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jerry Scannell</title>
		<link>http://blog.sqlauthority.com/2009/12/02/sql-server-validate-an-xml-document-in-tsql-using-xsd-by-jacob-sebastian/#comment-64334</link>
		<dc:creator><![CDATA[Jerry Scannell]]></dc:creator>
		<pubDate>Fri, 02 Apr 2010 17:45:16 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=7505#comment-64334</guid>
		<description><![CDATA[I&#039;ve tried everything I can to create an XML SCHEMA in SQL Server 2008.

Maybe someone can help.  Here&#039;s the XML that I need a schema for:

e4933d5d-7452-4fad-b557-125d700da000

Here is my original XSD SCHEMA that successfully &#039;compiled&#039; into a XML SCHEMA:

CREATE XML SCHEMA COLLECTION [dbo].[GUIDSchema] 
AS 
N&#039;
     
        
           
              
                 
                    
                 
              
            
          
          
  &#039;
GO

Here is the function that makes use of the schema:
ALTER FUNCTION [dbo].[fnGUID_from_XML] ( @inputXML XML )
       RETURNS uniqueidentifier
AS
BEGIN
   DECLARE @ValidateXML as XML(GUIDSchema)
   SET     @ValidateXML = @inputXML
   
   DECLARE @GUID as uniqueidentifier
   DECLARE @PL_FILE TABLE (TempGUID uniqueidentifier )

   INSERT INTO @PL_FILE (TempGUID)
        SELECT ParamValues.Items.value(&#039;GUID[1]&#039;,&#039;uniqueidentifier&#039;)
          FROM @ValidateXML.nodes(&#039;/NODE&#039;) as ParamValues(Items)

   select @GUID  = TempGUID from @PL_FILE
   RETURN @GUID
END

However, when I try to compile the above function, I get this error:
Msg 9314, Level 16, State 1, Procedure fnGUID_from_XML, Line 18
XQuery [value()]: Cannot implicitly atomize or apply &#039;fn:data()&#039; to complex content elements, found type &#039;xs:anyType&#039; within inferred type &#039;element(GUID,xs:anyType) ?&#039;.


I have tried removing the various  tags from the schema, but can never compile the schema again.  The only code that creates a successful schema compilation is what I&#039;ve provided here.

Thanks in advance,
Jerry]]></description>
		<content:encoded><![CDATA[<p>I&#8217;ve tried everything I can to create an XML SCHEMA in SQL Server 2008.</p>
<p>Maybe someone can help.  Here&#8217;s the XML that I need a schema for:</p>
<p>e4933d5d-7452-4fad-b557-125d700da000</p>
<p>Here is my original XSD SCHEMA that successfully &#8216;compiled&#8217; into a XML SCHEMA:</p>
<p>CREATE XML SCHEMA COLLECTION [dbo].[GUIDSchema]<br />
AS<br />
N&#8217;</p>
<p>  &#8216;<br />
GO</p>
<p>Here is the function that makes use of the schema:<br />
ALTER FUNCTION [dbo].[fnGUID_from_XML] ( @inputXML XML )<br />
       RETURNS uniqueidentifier<br />
AS<br />
BEGIN<br />
   DECLARE @ValidateXML as XML(GUIDSchema)<br />
   SET     @ValidateXML = @inputXML</p>
<p>   DECLARE @GUID as uniqueidentifier<br />
   DECLARE @PL_FILE TABLE (TempGUID uniqueidentifier )</p>
<p>   INSERT INTO @PL_FILE (TempGUID)<br />
        SELECT ParamValues.Items.value(&#8216;GUID[1]&#8216;,&#8217;uniqueidentifier&#8217;)<br />
          FROM @ValidateXML.nodes(&#8216;/NODE&#8217;) as ParamValues(Items)</p>
<p>   select @GUID  = TempGUID from @PL_FILE<br />
   RETURN @GUID<br />
END</p>
<p>However, when I try to compile the above function, I get this error:<br />
Msg 9314, Level 16, State 1, Procedure fnGUID_from_XML, Line 18<br />
XQuery [value()]: Cannot implicitly atomize or apply &#8216;fn:data()&#8217; to complex content elements, found type &#8216;xs:anyType&#8217; within inferred type &#8216;element(GUID,xs:anyType) ?&#8217;.</p>
<p>I have tried removing the various  tags from the schema, but can never compile the schema again.  The only code that creates a successful schema compilation is what I&#8217;ve provided here.</p>
<p>Thanks in advance,<br />
Jerry</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ramdas</title>
		<link>http://blog.sqlauthority.com/2009/12/02/sql-server-validate-an-xml-document-in-tsql-using-xsd-by-jacob-sebastian/#comment-58120</link>
		<dc:creator><![CDATA[ramdas]]></dc:creator>
		<pubDate>Wed, 02 Dec 2009 20:15:24 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=7505#comment-58120</guid>
		<description><![CDATA[Hi Pinal,
When i modified the CREATE XML SCHEMA COLLECTION to include the element name it worked:
&lt;code style=&quot;font-size:12px;&quot;&gt;&lt;span style=&quot;color:blue;&quot;&gt;CREATE&#160;&lt;/span&gt;&lt;span style=&quot;color:black;&quot;&gt;XML&#160;&lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;SCHEMA&#160;&lt;/span&gt;&lt;span style=&quot;color:black;&quot;&gt;COLLECTION&#160;EmployeeSchema
&lt;br /&gt;&#160;&#160;&#160;&#160;&lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;AS&lt;/span&gt;&lt;span style=&quot;color:red;&quot;&gt;&#039;&lt;xsd:schema&#160;xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot;&gt;
&lt;br /&gt;&#160;&#160;&#160;&#160;&lt;xsd:element&#160;name&#160;=&#160;&quot;Employee&quot;&#160;&gt;
&lt;br /&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&lt;xsd:complexType&gt;
&lt;br /&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&lt;xsd:sequence&gt;
&lt;br /&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&lt;xsd:element&#160;name&#160;=&#160;&quot;FirstName&quot;&#160;/&gt;
&lt;br /&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&lt;xsd:element&#160;name&#160;=&#160;&quot;MiddleName&quot;/&gt;
&lt;br /&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&lt;xsd:element&#160;name&#160;=&#160;&quot;LastName&quot;&#160;/&gt;
&lt;br /&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&lt;/xsd:sequence&gt;
&lt;br /&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&lt;/xsd:complexType&gt;
&lt;br /&gt;&#160;&#160;&#160;&#160;&lt;/xsd:element&gt;
&lt;br /&gt;&lt;/xsd:schema&gt;&#039;&lt;/span&gt;&lt;/code&gt;]]></description>
		<content:encoded><![CDATA[<p>Hi Pinal,<br />
When i modified the CREATE XML SCHEMA COLLECTION to include the element name it worked:<br />
<code style="font-size:12px;"><span style="color:blue;">CREATE&nbsp;</span><span style="color:black;">XML&nbsp;</span><span style="color:blue;">SCHEMA&nbsp;</span><span style="color:black;">COLLECTION&nbsp;EmployeeSchema<br />
<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color:blue;">AS</span><span style="color:red;">'&lt;xsd:schema&nbsp;xmlns:xsd=&quot;<a href="http://www.w3.org/2001/XMLSchema&quot;&#038;gt" rel="nofollow">http://www.w3.org/2001/XMLSchema&quot;&#038;gt</a>;<br />
<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;xsd:element&nbsp;name&nbsp;=&nbsp;&quot;Employee&quot;&nbsp;&gt;<br />
<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;xsd:complexType&gt;<br />
<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;xsd:sequence&gt;<br />
<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;xsd:element&nbsp;name&nbsp;=&nbsp;&quot;FirstName&quot;&nbsp;/&gt;<br />
<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;xsd:element&nbsp;name&nbsp;=&nbsp;&quot;MiddleName&quot;/&gt;<br />
<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;xsd:element&nbsp;name&nbsp;=&nbsp;&quot;LastName&quot;&nbsp;/&gt;<br />
<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/xsd:sequence&gt;<br />
<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/xsd:complexType&gt;<br />
<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;/xsd:element&gt;<br />
<br />&lt;/xsd:schema&gt;'</span></code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ramdas</title>
		<link>http://blog.sqlauthority.com/2009/12/02/sql-server-validate-an-xml-document-in-tsql-using-xsd-by-jacob-sebastian/#comment-58110</link>
		<dc:creator><![CDATA[ramdas]]></dc:creator>
		<pubDate>Wed, 02 Dec 2009 15:02:38 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=7505#comment-58110</guid>
		<description><![CDATA[Hi Pinal,
When i ran the CREATE XML SCHEMA script, i got this error:
Msg 2299, Level 16, State 1, Line 1
Required attribute &quot;name&quot; of XSD element &quot;element&quot; is missing.

Any thoughts on this.

Thank you]]></description>
		<content:encoded><![CDATA[<p>Hi Pinal,<br />
When i ran the CREATE XML SCHEMA script, i got this error:<br />
Msg 2299, Level 16, State 1, Line 1<br />
Required attribute &#8220;name&#8221; of XSD element &#8220;element&#8221; is missing.</p>
<p>Any thoughts on this.</p>
<p>Thank you</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dan</title>
		<link>http://blog.sqlauthority.com/2009/12/02/sql-server-validate-an-xml-document-in-tsql-using-xsd-by-jacob-sebastian/#comment-58101</link>
		<dc:creator><![CDATA[Dan]]></dc:creator>
		<pubDate>Wed, 02 Dec 2009 12:57:55 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=7505#comment-58101</guid>
		<description><![CDATA[How does the schema shown above enforce having elements named FirstName, MiddleName, LastName?]]></description>
		<content:encoded><![CDATA[<p>How does the schema shown above enforce having elements named FirstName, MiddleName, LastName?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ganesh</title>
		<link>http://blog.sqlauthority.com/2009/12/02/sql-server-validate-an-xml-document-in-tsql-using-xsd-by-jacob-sebastian/#comment-58085</link>
		<dc:creator><![CDATA[Ganesh]]></dc:creator>
		<pubDate>Wed, 02 Dec 2009 04:44:36 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=7505#comment-58085</guid>
		<description><![CDATA[Simple and perfect example, for any newbie to understand. Great thanks to sebastian and pinal for this lucid explanation.]]></description>
		<content:encoded><![CDATA[<p>Simple and perfect example, for any newbie to understand. Great thanks to sebastian and pinal for this lucid explanation.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
