﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2005 / T-SQL (SS2K5)  / 'ROOT' directive in SELECT query / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Fri, 24 May 2013 03:40:25 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: 'ROOT' directive in SELECT query</title><link>http://www.sqlservercentral.com/Forums/Topic434837-338-1.aspx</link><description>All,Thanks for your valuable inputs. I Asked DBA's to change compatability level to 90 but he did not agree as he is not sure if that would cause any other issues.I created a new test database in SQL Server 2005 and was able to use ROOT command in that database. Other database (created using SQL Server 2000) on same server gives error.</description><pubDate>Thu, 20 Dec 2007 11:23:38 GMT</pubDate><dc:creator>Ramesh Lende</dc:creator></item><item><title>RE: 'ROOT' directive in SELECT query</title><link>http://www.sqlservercentral.com/Forums/Topic434837-338-1.aspx</link><description>Ramesh,I do not know if you have resolved this issue, but the reason we want you to check your compatibility level is because the new SQL 2005 features are not available in compatability mode 80.</description><pubDate>Thu, 20 Dec 2007 11:10:23 GMT</pubDate><dc:creator>Adam Haines</dc:creator></item><item><title>RE: 'ROOT' directive in SELECT query</title><link>http://www.sqlservercentral.com/Forums/Topic434837-338-1.aspx</link><description>I am not having a problem and here is test case.[code]select database_id,namefrom master.sys.databaseswhere	database_id &amp;lt;= 5FOR XML AUTO, ELEMENTS, ROOT('databases')[/code]</description><pubDate>Thu, 20 Dec 2007 08:20:21 GMT</pubDate><dc:creator>Carl Federl</dc:creator></item><item><title>RE: 'ROOT' directive in SELECT query</title><link>http://www.sqlservercentral.com/Forums/Topic434837-338-1.aspx</link><description>[quote]Check that the compatability mode of the database you're running this in is set to 90 [/quote]Agreed.</description><pubDate>Wed, 19 Dec 2007 15:40:50 GMT</pubDate><dc:creator>Adam Haines</dc:creator></item><item><title>RE: 'ROOT' directive in SELECT query</title><link>http://www.sqlservercentral.com/Forums/Topic434837-338-1.aspx</link><description>I tried with RAW this also fails...SELECT * FROM customer FOR XML RAW, ELEMENTS, root('customers')</description><pubDate>Wed, 19 Dec 2007 09:54:53 GMT</pubDate><dc:creator>Ramesh Lende</dc:creator></item><item><title>RE: 'ROOT' directive in SELECT query</title><link>http://www.sqlservercentral.com/Forums/Topic434837-338-1.aspx</link><description>Check that the compatability mode of the database you're running this in is set to 90</description><pubDate>Wed, 19 Dec 2007 09:54:35 GMT</pubDate><dc:creator>GilaMonster</dc:creator></item><item><title>RE: 'ROOT' directive in SELECT query</title><link>http://www.sqlservercentral.com/Forums/Topic434837-338-1.aspx</link><description>The "ROOT" keyword is only available with the "RAW" option and is not available with the "AUTO" option.</description><pubDate>Wed, 19 Dec 2007 09:52:21 GMT</pubDate><dc:creator>Carl Federl</dc:creator></item><item><title>'ROOT' directive in SELECT query</title><link>http://www.sqlservercentral.com/Forums/Topic434837-338-1.aspx</link><description>Hello,I am trying to create an xml from a table with tags for each field in the table. Basically i am trying to run following query in SQL Server 2005SELECT * FROM customer FOR XML AUTO, ELEMENTS, ROOT('customers')This gives an error. Line 2: Incorrect syntax near 'ROOT'.I think ROOT command is correct so not sure where the problem is. Do i need to change any settings on SQL Server?Thanks,Ramesh.</description><pubDate>Wed, 19 Dec 2007 09:39:41 GMT</pubDate><dc:creator>Ramesh Lende</dc:creator></item></channel></rss>