﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Future Versions / SQL 12 </title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Wed, 19 Jun 2013 01:10:00 GMT</lastBuildDate><ttl>20</ttl><item><title>Adding Global and Scope Variables</title><link>http://www.sqlservercentral.com/Forums/Topic1180614-2800-1.aspx</link><description>There must be an life saving global variables to use per connection like:DECLARE @@MYVAR1 BIGINTDECLARE @@MYVAR2 VARCHAR(30)SET @@MYVAR1 = 123456SET @@MYVAR2 = 'Username'So we can use it to pass or use them anywhere on the sql server.For eg: When a user opens my application, I'll pass @@MYVAR1 and @@MYVAR2.Then I'll assign fields default value to @@MYVAR1 and @@MYVAR2 so I never ever need to pass extra params from application to stored procedures or queries to save them in tables. Also this is very useful if you want to do table or record security works.</description><pubDate>Sun, 25 Sep 2011 04:36:46 GMT</pubDate><dc:creator>wshmstr</dc:creator></item><item><title>XMLTABLE - XML/SQL Functionality</title><link>http://www.sqlservercentral.com/Forums/Topic1072023-2800-1.aspx</link><description>Hi all,Its not that often we get thanked by MS for suggesting things that they want to do, but have been unable to implement due to a lack of knowledge/customer demand in an area which would not be know about unless you have worked with other RDMBS vendor systems.Without some help from fellow SQL Server professionals which do extensive work in XML - we would not get this useful functionality which MS want to give us and rid of us some non-intuitive proprietry commands.[Apologies in advance - if this is not the right place to place this feedback]This functionality is the XMLTABLE command (XML/SQL - standard) which gives the ability to shred XML Documents quickly with a lower amount of code required than the current .nodes() or OPENXML processing methodology.Take the following XML Example:[code="plain"]DECLARE @xml XMLSELECT @xml ='&amp;lt;dept bldg="101"&amp;gt;            &amp;lt;employee id="901"&amp;gt;		&amp;lt;name&amp;gt;			&amp;lt;first&amp;gt;John&amp;lt;/first&amp;gt;			&amp;lt;last&amp;gt;Doe&amp;lt;/last&amp;gt;		&amp;lt;/name&amp;gt;		&amp;lt;office&amp;gt;344&amp;lt;/office&amp;gt;		&amp;lt;salary currency="USD"&amp;gt;55000&amp;lt;/salary&amp;gt;	&amp;lt;/employee&amp;gt;	&amp;lt;employee id="902"&amp;gt;		&amp;lt;name&amp;gt;			&amp;lt;first&amp;gt;Peter&amp;lt;/first&amp;gt;			&amp;lt;last&amp;gt;Pan&amp;lt;/last&amp;gt;		&amp;lt;/name&amp;gt;		&amp;lt;office&amp;gt;216&amp;lt;/office&amp;gt;		&amp;lt;phone&amp;gt;905-416-5004&amp;lt;/phone&amp;gt;	&amp;lt;/employee&amp;gt;&amp;lt;/dept&amp;gt;'[/code]Current version: (using .nodes() - method)  [267 chars][code="plain"]SELECT xml_data.value('@id[1]','int') empID,           name_info.value('first[1]','varchar(max)') first_name,           name_info.value('last[1]','varchar(max)') last_nameFROM @xml.nodes ('dept/employee') xml1(xml_data)CROSS APPLY xml_data.nodes ('name') name_list(name_info)[/code]New version: (using Standardised XML/SQL XMLTABLE command) [217 chars][code="plain"]SELECT X.* FROM emp, XMLTABLE ('$d/dept/employee' passing doc as "d"    COLUMNS    empID 	INTEGER 	PATH '@id',   firstname 	VARCHAR(20) 	PATH 'name/first',   lastname 	VARCHAR(25) 	PATH 'name/last') AS X[/code]Personally I prefer the cleaner XMLTABLE version for the following reasons:* Standardised across all major RDBMS (IBM/ORACLE) etc [Easier to port from other systems to/from SQL Server]* Cleaner code produced - reduces need for redundant code blocks (.nodes() / .value), allows for many multiple paths to be used without requiring cross apply joins within the code.* Easier to read the XMLTABLE syntax  - as its cleaner and matchs the paths more directly without having to cross-reference cross-apply joins.Please show your support for this syntax as a requirement to our friends at MS; so we can get an improved way to quickly shred XML document in the future so this gets on the radar:https://connect.microsoft.com/SQLServer/feedback/details/644485/xmltable-output[For those who are interested in the full spec of the XML/SQL Standard check out the detail information on the feedback]Thanks-in advance,D</description><pubDate>Wed, 02 Mar 2011 09:31:38 GMT</pubDate><dc:creator>d_sysuk</dc:creator></item></channel></rss>