SQL Server - Xml Schema

Asked By Utopio
06-Mar-07 10:35 AM
How can I define the rule:


I write this:


but it's not valid !!!

Thanks
  Denis Ruckebusch [MSFT] replied...
09-Mar-07 01:57 PM
It looks like your current content model violates the Unique Particle
Attribution rule.

I think something like this should meet your needs though


I hope this helps. Don't hesitate to ask if you have more questions.


Denis Ruckebusch
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
Create New Account
help
SqlServer.Chainer.Infrastructure.LogProviderStatus' has been registered 2010-09-15 17:26:35 Slp: Reading XML resource 'Microsoft.SQL.Chainer.PackageData.Package.xml' 2010-09-15 17:26:35 Slp: Reading schema resource 'Microsoft.SQL.Chainer.Package.Package xsd' 2010-09-15 17:26:35 Slp: Document 'Microsoft.SQL.Chainer.PackageData.Package.xml' validated with schema 'Microsoft.SQL.Chainer.Package.Package.xsd' has been successfuly loaded into datastore 17:26:36 Slp: Running Action: ReadProductXML 2010-09-15 17:26:36 Slp: Reading XML resource 'Microsoft.SQL.Chainer.Product.Product.xml' 2010-09-15 17:26:36 Slp: Reading schema resource 'Microsoft.SQL.Chainer.Product.Product xsd' 2010-09-15 17:26:36 Slp: Document 'Microsoft.SQL.Chainer.Product.Product.xml' validated with schema 'Microsoft.SQL.Chainer.Product.Product.xsd' has been successfuly loaded into datastore resource 'Microsoft.SqlServer.Configuration.SetupExtension.SlpChainerInputSettings.xsd' 2010-09-15 17:26:38 Slp: Reading XML resource 'Microsoft.SqlServer.Configuration.SetupExtension.SlpChainerInputSettingsDefaults.xml' 2010-09-15 17:26:38 Slp: Document 'Microsoft.SqlServer.Configuration.SetupExtension.SlpChainerInputSettingsDefaults.xml' validated
Help for XML data type in ms-sqlserver SQL Server Hi guys, ive searched net but could not INVOICEID in a loop. now i want to design a sqlserver stored procedure with an xml parameter, and returning identity ID value in invoice table. my xml should look like that; with one shot, i want to save this schema into database. dbo.proc_saveinvoice(xmlinvoice:xml) any idea? Thanks for all;) SQL Server Discussions SQL Server 2005 (1) SQL Server 2000 should", I assume that you have control over the design of the document. Attribute-centric XML is easier to deal with: I also removed the <LINES> tag, because it serves no SELECT Docnumber = T.c.value('@DOCNUMBER', 'nvarchar(30)'), Date = T.c.value('@DATE', 'datetime') FROM @xml.nodes(' / ROOT / INVOICE') AS T(c) INSERT invoicedetails (invoiceid, product_id, amount, price) SELECT t.id line.c.value('@AMOUT', 'numeric(18, 3)'), line.c.value('@PRICE', 'numeric(18, 2)') FROM @xml.nodes(' / ROOT / INVOICE') AS T(c) JOIN @t t ON t.docunumber = T.c.value sqlserver / bb895970.aspx thanks for your explanatory reply first of all sorry, in my sample xml i had repeated first line by mistake. the second line there should look like PRODUCTID
Create XML from table, then re-create tabular data set from XML: How to? SQL Server I am a complete noob when it comes to XML. Not to sound lazy, but I kind of want to remain a noob regarding XML :) I only want to learn the absolute bare bones that will perform my requirements. My requirements: 1. Create an XML file of the data from an existing table in the simplest way possible. 2. Write a query that will read the xml and "re-create" the tablular data set. Sample: CREATE TABLE xml_test ( vin_tx VARCHAR(17) , manufacturer_nm CCC4588890ABC123', 'Ford', 2007, 'F-150''s test tricky data') Run this query to assign the xml to a variable: DECLARE @xml_data xml SET @xml_data = (SELECT * FROM xml_test AS CarInfo FOR XML AUTO, ELEMENTS) SELECT @xml_data I want
xml parsing with xquery returning null records SQL Server I have recently begun receiving xml files and ran into a small problem that seems syntax related, but I simply cannot find where it is. Below is the xml file and sample code of what I am doing. I cut up the xml data, it is far more complex then what I am presenting below. I think it select x.value('eventId[1] / eventId[1]', 'int') as url FROM ( SELECT CAST(x AS XML) FROM OPENROWSET( BULK 'c: \ videofile.xml', SINGLE_BLOB) AS T(x) ) AS T(x) CROSS APPLY x.nodes('pitchMediaList / pitchMedia') AS X(pitchMedia); SQL Server XML Discussions SQL Server 2005 (1) SQL Server 2000 (1) SQL Server (1) BLOB (1) Online 1) Xml parsing (1) Xml file (1) Dan (dquill1@gmail.com) writes: When you retrieve attribute, you
XML and GROUP BY SQL Server Hi, I do not know how to solve the following dddd | | 5 | 2 | eeee | _ __ __ __ __ __ __ __ __ __ __ __ __ __ I need to return a dataset like this: ID | Name | XML Where ID and Name come from Table 1, and the last cell contains the XML representation of Table 2 (join on Table1.ID = Table2.ParentID). I can run a sub t LEFT JOIN ( SELECT ParentID, ID "id", Value "value" FROM Table2 GROUP BY ParentID FOR XML PATH('element'), ROOT('base') ) t2 ON t.ID = t2.ParentID But the syntax is not OUTER APPLY (SELECT t2.Value "value" FROM Table2 t2 WHERE t.ID = t2.ParentID FOR XML PATH('element'), ROOT('base')) AS t2 There is OUTER APPLY and CROSS APPLY. If there occours because the APPLY clause is used to call a table-valued function, and FOR XML returns only one value, it can be represented by a scalar-value function. Additionally I of a query" (http: / / msdn.microsoft.com / en-US / library / ms175156.aspx), so the FOR XML part of this query will be invoked alot of times, it is right? I thik I forgot that you need to specify the column name with the alias when FOR XML is in play, as the column name in the subquery is consumed by FOR XML