Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XML
|
XML General XML discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XML section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 12th, 2007, 12:39 PM
Registered User
 
Join Date: Feb 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default sql server xml

i purchase xml database;
 using mssql 2000
this code gives me an error (Incorrect syntax near 'XML'.)


select region.region as name, region.population , region.area,
 (Select Country.country as name, Country.currency,
   (Select state.state as name, state.nickname
    from state where state.country_id = Country.country_id FOR XML AUTO)
    from Country where Country.region_id = region.region_id FOR XML AUTO)
from region FOR XML AUTO, ROOT, elements

 
Old February 12th, 2007, 12:50 PM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

As far as I understood SQL 2000 does not support nested FOR XML queries, only SQL 2005 does that. For what you need you will have to use FOR XML EXPLICIT.

--

Joe (Microsoft MVP - XML)





Similar Threads
Thread Thread Starter Forum Replies Last Post
SQL Server 2005 XML: FOR XML PATH -> cdata? stoves SQL Server 2005 1 July 8th, 2008 02:40 AM
XML vs SQL Server 2005 yadavrahul2k5 XML 2 June 1st, 2008 02:59 AM
How to import XML into SQL Server dbellavi XML 1 February 26th, 2008 06:02 AM
Display XML from SQL SERVER toddw607 SQL Server 2000 0 May 31st, 2007 08:29 AM
xml href from sql server toddw607 SQL Server 2000 9 May 14th, 2007 06:24 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.