The document discusses new XML features in SQL Server 2008, including enhancements to XML schema validation, support for additional data types like datetimes with time zones, and improved handling of union and list types. It also covers expanded XQuery capabilities and new XML data manipulation features.
SQL202.2 Accelerated Introduction to SQL Using SQL Server Module 2Dan D'Urso
Accelerated Introduction to SQL Using Microsoft SQL Server Module 2. Covers inner, outer and self joins, correlated and uncorrelated subqueries, unions, aggregate functions, calculated fields and grouping.
Migration Database from SQL SERVER 2012 to Oracle12c with Pluggable Database Monowar Mukul
This is relate to migration Database testing from SQLSERVER2012 to Oracle12c with Pluggable Database. Here I have focused on single table as of time stress.
Same can be applied for SQL SERVER 2005 and 2008.
SQL202.2 Accelerated Introduction to SQL Using SQL Server Module 2Dan D'Urso
Accelerated Introduction to SQL Using Microsoft SQL Server Module 2. Covers inner, outer and self joins, correlated and uncorrelated subqueries, unions, aggregate functions, calculated fields and grouping.
Migration Database from SQL SERVER 2012 to Oracle12c with Pluggable Database Monowar Mukul
This is relate to migration Database testing from SQLSERVER2012 to Oracle12c with Pluggable Database. Here I have focused on single table as of time stress.
Same can be applied for SQL SERVER 2005 and 2008.
SQL is a database computer language designed for the retrieval and management of data in relational database. SQL stands for Structured Query Language.
SQL Developer provides powerful editors for working with SQL, PL/SQL, Stored Java Procedures, and XML.
Run queries, generate execution plans, export data to the desired format (XML, Excel, HTML, PDF, etc.), execute, debug, test, and document your database programs, and much more with SQL Developer.
SQL Developer provides powerful editors for working with SQL, PL/SQL, Stored Java Procedures, and XML.
Introduction into the EHRI Conversion Tool. This tool is simple in use and can generate EAD-files conform with EHRI standards so that an export can be made to EHRI.
An SQL JOIN clause combines columns from one or more tables in a relational database. It creates a set that can be saved as a table or used as it is. A JOIN is a means for combining columns from one (self-table) or more tables by using values common to each.
Agenda:
- Debate inicial
- Suas experiências: XML e SQL Server
- XML e tecnologias relacionadas
- O que é XML?
- XML bem-formado
- XML Schema e XML válido
- XPath e XQuery
- Algumas aplicações de XML
- Suporte XML no SQL Server
- Tipo de dado XML nativo
- XML Schema Collections
- Métodos do tipo de dados XML
- Cláusula FOR XML
- Debate final
- Minhas experiências: XML e SQL Server
SQL is a database computer language designed for the retrieval and management of data in relational database. SQL stands for Structured Query Language.
SQL Developer provides powerful editors for working with SQL, PL/SQL, Stored Java Procedures, and XML.
Run queries, generate execution plans, export data to the desired format (XML, Excel, HTML, PDF, etc.), execute, debug, test, and document your database programs, and much more with SQL Developer.
SQL Developer provides powerful editors for working with SQL, PL/SQL, Stored Java Procedures, and XML.
Introduction into the EHRI Conversion Tool. This tool is simple in use and can generate EAD-files conform with EHRI standards so that an export can be made to EHRI.
An SQL JOIN clause combines columns from one or more tables in a relational database. It creates a set that can be saved as a table or used as it is. A JOIN is a means for combining columns from one (self-table) or more tables by using values common to each.
Agenda:
- Debate inicial
- Suas experiências: XML e SQL Server
- XML e tecnologias relacionadas
- O que é XML?
- XML bem-formado
- XML Schema e XML válido
- XPath e XQuery
- Algumas aplicações de XML
- Suporte XML no SQL Server
- Tipo de dado XML nativo
- XML Schema Collections
- Métodos do tipo de dados XML
- Cláusula FOR XML
- Debate final
- Minhas experiências: XML e SQL Server
SSDT Workshop @ SQL Bits X (2012-03-29)Gert Drapers
Mastering SSDT with the DataDude
This is your chance to hear the real story behind SSDT, directly from the man who built it. SQL Server Data Tools is effectively the 3rd version of the DataDude project, started in 2005 by Gert Drapers. SQL Server Data Tools (SSDT) lets you develop, test, and maintain SQL Server and SQL Azure databases offline on your desktop. SSDT's modern T-SQL development environment supports declarative model-driven development whether working connected or offline, and integrates with Visual Studio's project and application lifecycle management tools to enable team development and source code control support for SQL Server and SQL Azure databases.
This master class will get you started using SSDT; provides you with the architectural ins and outs of schema management using SSDT; team oriented database development and leveraging the command line and programmatic interfaces that accompany SSDT for importing, comparing and deploying database schemas. Learn it from the DataDude himself.
Guide to using the CAMV test suite approach for XML testing. Download CAMV open source tool from http://www.cameditor.org and see videos here: http://www.youtube.com/watch?v=yaCwiIX5lM4
SQL202.3 Accelerated Introduction to SQL Using SQL Server Module 3Dan D'Urso
Accelerated Introduction to SQL using Microsoft SQL Server. Covers insert, update, delete, create, drop, alter statements. Includes views, indexes, tables, constraints.
IBM Informix® Dynamic Server (IDS) 11 has new features to enable IDS applications to work with, store and search XML. This session discusses various scenarios and illustrates how to use and exploit these features.
In his public lecture, Christian Timmerer provides insights into the fascinating history of video streaming, starting from its humble beginnings before YouTube to the groundbreaking technologies that now dominate platforms like Netflix and ORF ON. Timmerer also presents provocative contributions of his own that have significantly influenced the industry. He concludes by looking at future challenges and invites the audience to join in a discussion.
UiPath Test Automation using UiPath Test Suite series, part 6DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 6. In this session, we will cover Test Automation with generative AI and Open AI.
UiPath Test Automation with generative AI and Open AI webinar offers an in-depth exploration of leveraging cutting-edge technologies for test automation within the UiPath platform. Attendees will delve into the integration of generative AI, a test automation solution, with Open AI advanced natural language processing capabilities.
Throughout the session, participants will discover how this synergy empowers testers to automate repetitive tasks, enhance testing accuracy, and expedite the software testing life cycle. Topics covered include the seamless integration process, practical use cases, and the benefits of harnessing AI-driven automation for UiPath testing initiatives. By attending this webinar, testers, and automation professionals can gain valuable insights into harnessing the power of AI to optimize their test automation workflows within the UiPath ecosystem, ultimately driving efficiency and quality in software development processes.
What will you get from this session?
1. Insights into integrating generative AI.
2. Understanding how this integration enhances test automation within the UiPath platform
3. Practical demonstrations
4. Exploration of real-world use cases illustrating the benefits of AI-driven test automation for UiPath
Topics covered:
What is generative AI
Test Automation with generative AI and Open AI.
UiPath integration with generative AI
Speaker:
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
Threats to mobile devices are more prevalent and increasing in scope and complexity. Users of mobile devices desire to take full advantage of the features
available on those devices, but many of the features provide convenience and capability but sacrifice security. This best practices guide outlines steps the users can take to better protect personal devices and information.
Dr. Sean Tan, Head of Data Science, Changi Airport Group
Discover how Changi Airport Group (CAG) leverages graph technologies and generative AI to revolutionize their search capabilities. This session delves into the unique search needs of CAG’s diverse passengers and customers, showcasing how graph data structures enhance the accuracy and relevance of AI-generated search results, mitigating the risk of “hallucinations” and improving the overall customer journey.
DevOps and Testing slides at DASA ConnectKari Kakkonen
My and Rik Marselis slides at 30.5.2024 DASA Connect conference. We discuss about what is testing, then what is agile testing and finally what is Testing in DevOps. Finally we had lovely workshop with the participants trying to find out different ways to think about quality and testing in different parts of the DevOps infinity loop.
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionAggregage
Join Maher Hanafi, VP of Engineering at Betterworks, in this new session where he'll share a practical framework to transform Gen AI prototypes into impactful products! He'll delve into the complexities of data collection and management, model selection and optimization, and ensuring security, scalability, and responsible use.
Removing Uninteresting Bytes in Software FuzzingAftab Hussain
Imagine a world where software fuzzing, the process of mutating bytes in test seeds to uncover hidden and erroneous program behaviors, becomes faster and more effective. A lot depends on the initial seeds, which can significantly dictate the trajectory of a fuzzing campaign, particularly in terms of how long it takes to uncover interesting behaviour in your code. We introduce DIAR, a technique designed to speedup fuzzing campaigns by pinpointing and eliminating those uninteresting bytes in the seeds. Picture this: instead of wasting valuable resources on meaningless mutations in large, bloated seeds, DIAR removes the unnecessary bytes, streamlining the entire process.
In this work, we equipped AFL, a popular fuzzer, with DIAR and examined two critical Linux libraries -- Libxml's xmllint, a tool for parsing xml documents, and Binutil's readelf, an essential debugging and security analysis command-line tool used to display detailed information about ELF (Executable and Linkable Format). Our preliminary results show that AFL+DIAR does not only discover new paths more quickly but also achieves higher coverage overall. This work thus showcases how starting with lean and optimized seeds can lead to faster, more comprehensive fuzzing campaigns -- and DIAR helps you find such seeds.
- These are slides of the talk given at IEEE International Conference on Software Testing Verification and Validation Workshop, ICSTW 2022.
Maruthi Prithivirajan, Head of ASEAN & IN Solution Architecture, Neo4j
Get an inside look at the latest Neo4j innovations that enable relationship-driven intelligence at scale. Learn more about the newest cloud integrations and product enhancements that make Neo4j an essential choice for developers building apps with interconnected data and generative AI.
Pushing the limits of ePRTC: 100ns holdover for 100 daysAdtran
At WSTS 2024, Alon Stern explored the topic of parametric holdover and explained how recent research findings can be implemented in real-world PNT networks to achieve 100 nanoseconds of accuracy for up to 100 days.
Climate Impact of Software Testing at Nordic Testing DaysKari Kakkonen
My slides at Nordic Testing Days 6.6.2024
Climate impact / sustainability of software testing discussed on the talk. ICT and testing must carry their part of global responsibility to help with the climat warming. We can minimize the carbon footprint but we can also have a carbon handprint, a positive impact on the climate. Quality characteristics can be added with sustainability, and then measured continuously. Test environments can be used less, and in smaller scale and on demand. Test techniques can be used in optimizing or minimizing number of tests. Test automation can be used to speed up testing.
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfPaige Cruz
Monitoring and observability aren’t traditionally found in software curriculums and many of us cobble this knowledge together from whatever vendor or ecosystem we were first introduced to and whatever is a part of your current company’s observability stack.
While the dev and ops silo continues to crumble….many organizations still relegate monitoring & observability as the purview of ops, infra and SRE teams. This is a mistake - achieving a highly observable system requires collaboration up and down the stack.
I, a former op, would like to extend an invitation to all application developers to join the observability party will share these foundational concepts to build on:
Unlocking Productivity: Leveraging the Potential of Copilot in Microsoft 365, a presentation by Christoforos Vlachos, Senior Solutions Manager – Modern Workplace, Uni Systems
UiPath Test Automation using UiPath Test Suite series, part 5DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 5. In this session, we will cover CI/CD with devops.
Topics covered:
CI/CD with in UiPath
End-to-end overview of CI/CD pipeline with Azure devops
Speaker:
Lyndsey Byblow, Test Suite Sales Engineer @ UiPath, Inc.
GridMate - End to end testing is a critical piece to ensure quality and avoid...ThomasParaiso2
End to end testing is a critical piece to ensure quality and avoid regressions. In this session, we share our journey building an E2E testing pipeline for GridMate components (LWC and Aura) using Cypress, JSForce, FakerJS…
GridMate - End to end testing is a critical piece to ensure quality and avoid...
Sql server 2008 r2 xml wp
1. What’s New for XML in SQL Server 2008?<br />White Paper<br />Published: August 2008<br />Summary: Microsoft® SQL Server™ 2008 builds on the extensive support for XML by extending support for XML schema validation and XQuery, and by enhancing the xml data type.<br />.<br />Contents<br /> TOC quot;
1-2quot;
Introduction PAGEREF _Toc205573720 1<br />The Evolution of SQL Server XML Capabilities PAGEREF _Toc205573721 1<br />XML Functionality in SQL Server 2000 PAGEREF _Toc205573722 1<br />XML Functionality in SQL Server 2005 PAGEREF _Toc205573723 2<br />XML Functionality in SQL Server 2008 PAGEREF _Toc205573724 5<br />XML Schema Validation Enhancements PAGEREF _Toc205573725 5<br />Lax Validation Support PAGEREF _Toc205573726 6<br />Full xs:dateTime Support PAGEREF _Toc205573727 7<br />Union and List Types PAGEREF _Toc205573728 8<br />XQuery Enhancements PAGEREF _Toc205573729 10<br />XML DML Enhancements PAGEREF _Toc205573730 11<br />Conclusion PAGEREF _Toc205573731 12<br />Introduction<br />Microsoft introduced XML-related capabilities in Microsoft SQL Server 2000 with the FOR XML and OPENXML Transact-SQL keywords, which enabled developers to write Transact-SQL code to retrieve a query result as a stream of XML, and to shred an XML document into a rowset. These XML capabilities were extended significantly in SQL Server 2005 with the introduction of a native xml data type that supports XSD schema validation, XQuery-based operations, and XML indexing. SQL Server 2008 builds on the XML capabilities of previous releases and provides enhancements to meet the challenges that customers have faced when storing and manipulating XML data in the database.<br />The Evolution of SQL Server XML Capabilities<br />The XML features of SQL Server have evolved with each version of SQL Server since SQL Server 2000. Before we examine the enhancements in SQL Server 2008, it might be useful to chart the evolution of XML functionality through the previous versions.<br />XML Functionality in SQL Server 2000<br />In SQL Server 2000, Microsoft introduced the FOR XML and OPENXML Transact-SQL keywords. FOR XML is an extension to the SELECT statement that returns the query results as a stream of XML as shown in the following example.<br />SELECT ProductID, ProductName<br />FROM Products Product<br />FOR XML AUTO<br />This query returns an XML fragment like the following example.<br /><Product ProductID=quot;
1quot;
ProductName=quot;
Widgetquot;
/><br /><Product ProductID=quot;
2quot;
ProductName=quot;
Sprocketquot;
/><br />The OPENXML function performs the opposite function to the FOR XML clause by creating a rowset from an XML document, as shown in the following example.<br />DECLARE @doc nvarchar(1000)<br />SET @doc = '<Order OrderID = quot;
1011quot;
><br /><Item ProductID=quot;
1quot;
Quantity=quot;
2quot;
/><br /><Item ProductID=quot;
2quot;
Quantity=quot;
1quot;
/><br /></Order>'<br />DECLARE @xmlDoc integer<br />EXEC sp_xml_preparedocument @xmlDoc OUTPUT, @doc<br />SELECT * FROM<br />OPENXML (@xmlDoc, 'Order/Item', 1)<br />WITH<br />(OrderID integer '../@OrderID',<br /> ProductID integer,<br /> Quantity integer)<br />EXEC sp_xml_removedocument @xmlDoc<br />Note the use of the sp_xml_preparedocument and sp_xml_removedocument stored procedures to create an in-memory representation of the node tree for the XML document. This Transact-SQL code returns the following rowset.<br />OrderIDProductIDQuantity101112101121<br />XML Functionality in SQL Server 2005<br />In SQL Server 2005, the FOR XML feature was enhanced with new options for root elements and element names, the ability to nest FOR XML calls so you can build complex hierarchies, and a new PATH mode that enables you to define the structure of the XML to be retrieved by using XPath syntax, as shown in the following example.<br />SELECT ProductID AS '@ProductID',<br />ProductName AS 'ProductName'<br />FROM Products<br />FOR XML PATH ('Product'), ROOT ('Products')<br />This query returns the following XML.<br /><Products><br /><Product ProductID=quot;
1quot;
><br /><ProductName>Widget</ProductName><br /></Product><br /><Product ProductID=quot;
2quot;
><br /><ProductName>Sprocket</ProductName><br /></Product><br /></Products><br />In addition to enhancing the existing XML features that had been introduced in SQL Server 2000, SQL Server 2005 added a new, native xml data type that enables you to create variables and columns for XML data, as shown in the following example.<br />CREATE TABLE SalesOrders<br />(OrderID integer PRIMARY KEY,<br /> OrderDate datetime,<br /> CustomerID integer,<br /> OrderNotes xml)<br />You can use the xml data type to store markup documents or semi-structured data in the database. Columns and variables can be used for untyped XML or typed XML, the latter of which is validated against an XML Schema Definition (XSD) schema. To define the schemas for data validation, developers can use the CREATE XML SCHEMA COLLECTION statement, as shown in the following example.<br />CREATE XML SCHEMA COLLECTION ProductSchema AS<br />'<?xml version=quot;
1.0quot;
encoding=quot;
UTF-16quot;
?><br /><xs:schema xmlns:xs=quot;
http://www.w3.org/2001/XMLSchemaquot;
><br /> <!-- schema declarations go here --><br /></xs:schema>'<br />After creating a schema collection, you can associate an xml variable or column with the schema declarations it contains by referencing the schema collection as shown in the following example.<br />CREATE TABLE SalesOrders<br />(OrderID integer PRIMARY KEY,<br /> OrderDate datetime,<br /> CustomerID integer,<br /> OrderNotes xml(ProductSchema))<br />Typed XML is validated against the declarations in the associated schema collection when values are inserted or updated, which makes it possible to enforce business rules about the structure of XML data for compliance or compatibility reasons.<br />The xml data type also provides a number of methods, which you can use to query and manipulate the XML data in an instance. For example, you can use the query method to query the XML in an instance of the xml data type, as shown in the following example.<br />declare @x xml<br />set @x=<br />'<Invoices><br /><Invoice><br /><Customer>Kim Abercrombie</Customer><br /><Items><br /><Item ProductID=quot;
2quot;
Price=quot;
1.99quot;
Quantity=quot;
1quot;
/><br /><Item ProductID=quot;
3quot;
Price=quot;
2.99quot;
Quantity=quot;
2quot;
/><br /><Item ProductID=quot;
5quot;
Price=quot;
1.99quot;
Quantity=quot;
1quot;
/><br /></Items><br /></Invoice><br /><Invoice><br /><Customer>Margaret Smith</Customer><br /><Items><br /><Item ProductID=quot;
2quot;
Price=quot;
1.99quot;
Quantity=quot;
1quot;
/><br /></Items><br /></Invoice><br /></Invoices>'<br />SELECT @x.query(<br />'<CustomerList><br />{<br />for $invoice in /Invoices/Invoice<br />return $invoice/Customer<br />}<br /></CustomerList>')<br />The query in this example uses an XQuery expression that finds each Invoice element in the document and returns an XML document that contains the Customer element from each Invoice element, as shown in the following example.<br /><CustomerList><br /> <Customer>Kim Abercrombie</Customer><br /> <Customer>Margaret Smith</Customer><br /></CustomerList><br />Another significant XML-related feature that was introduced in SQL Server 2005 is support for XML indexes. You can create primary and secondary XML indexes for columns of type xml to enhance XML query performance. A primary XML index is a shredded representation of all of the nodes in an XML instance, which the query processor can use to quickly find nodes within an XML value. After you have created a primary XML index, you can create secondary XML indexes to improve the performance of specific types of query. The following example creates a primary XML index, and a secondary XML index of type PATH, which can improve performance of queries that use XPath expressions to identify nodes in an XML instance.<br />CREATE PRIMARY XML INDEX idx_xml_Notes<br />ON SalesOrders (Notes)<br />GO<br />CREATE XML INDEX idx_xml_Path_Notes<br />ON SalesOrders (Notes)<br />USING XML INDEX idx_xml_Notes<br />FOR PATH<br />GO<br />XML Functionality in SQL Server 2008<br />The XML functionality that was introduced in SQL Server 2000 and SQL Server 2005 has been enhanced in SQL Server 2008. Key XML-related enhancements in SQL Server 2008 include:<br />Improved schema validation capabilities<br />Enhancements to XQuery support<br />Enhanced functionality for performing XML data manipulation language (DML) insertions<br />The rest of this whitepaper examines these enhancements and demonstrates how you can use them to implement better XML solutions in SQL Server 2008.<br />XML Schema Validation Enhancements<br />You can validate XML data by enforcing compliance with one or several XSD schemas. A schema defines the permissible XML elements and attributes for a particular XML data structure, and is often used to ensure that XML documents contain all of the required data elements in the correct structure.<br />SQL Server 2005 introduced validation of XML data through the use of XML schema collections. The general approach is to a create schema collection that contains the schema rules for your XML data by using the CREATE XML SCHEMA COLLECTION statement, and then to reference the schema collection name when you define an xml column or variable that must conform to the schema rules in the schema collection. SQL Server then validates any data that is inserted or updated in the column or variable against the schema declarations in the schema collection.<br />XML Schema support in SQL Server 2005 implemented a broad subset of the full XML Schema specification, and covered the most common XML validation scenarios. SQL Server 2008 extends that support to include the following additional schema validation requirements that have been identified by customers:<br />Support for lax validation<br />Full support for dateTime, time and date validation, including preservation of time zone information<br />Improved Support for union and list types<br />Lax Validation Support<br />XML Schemas support wildcard sections in XML documents through the any, anyAttribute, and anyType declarations. For example, consider the following XML schema declaration.<br /><xs:complexType name=quot;
Orderquot;
mixed=quot;
truequot;
><br /> <xs:sequence><br /> <xs:element name=quot;
CustomerNamequot;
/><br /> <xs:element name=quot;
OrderTotalquot;
/><br /> <xs:any namespace=quot;
##otherquot;
processContents=quot;
skipquot;
<br />minOccurs=quot;
0quot;
maxOccurs=quot;
unboundedquot;
/><br /> </xs:sequence><br /></xs:complexType><br />This schema declaration defines an XML element named Order, which must contain sub-elements named CustomerName and OrderTotal. Additionally, the element can contain an unlimited number of other elements that belong to a different namespace than the one to which the Order type belongs. The following XML shows an XML document that contains an instance of an Order element as defined by this schema declaration. Note that the order also contains a shp:Delivery element, which is not explicitly defined in the schema.<br /><Invoice xmlns=quot;
http://adventure-works.com/orderquot;
<br />xmlns:shp=quot;
http://adventure-works.com/shippingquot;
><br /> <Order><br /> <CustomerName>Graeme Malcolm</CustomerName><br /> <OrderTotal>299.99</OrderTotal><br /> <shp:Delivery>Express</shp:Delivery><br /> </Order><br /></Invoice><br />Validation for wildcard sections depends on the processContents attribute for the wildcard section in the schema definition. In SQL Server 2005, schemas can use processContents values of skip and strict for any and anyAttribute declarations. In the previous example, the processContents attribute for the wildcard element has been set to skip, so no attempt to validate the contents of that element is made. Even if the schema collection includes a declaration for the shp:Delivery element (for example, defining a list of valid delivery methods), the element is not validated unless the declaration for the wildcard in the Order element has its processContents attribute set to strict.<br />SQL Server 2008 adds support for a third validation option. By setting the processContents attribute for a wildcard section to lax, you can enforce validation for any elements that have schema declarations associated with them, but ignore any elements that are not defined in the schema. To continue the previous example, if you set the processContents attribute for the wildcard element declaration in the schema to lax and add a declaration for the shp:Delivery element, shp:Delivery element in the XML document is validated. However, if instead of the shp:Delivery element, the document includes an element that is not defined in the schema, the element is ignored.<br />In addition, the XML Schema specification defines that the anyType declaration has lax processing of its content model. SQL Server 2005 does not support lax processing, so the content is validated strictly instead. SQL Server 2008 does support lax processing of the anyType contents, and so the content is validated correctly.<br />Full xs:dateTime Support<br />You can use the dateTime data type in an XML schema to define date and time data. Date and time data is expressed in the format 2007-08-01T09:30:00:000Z, which represents the 1st of August 2007 at 9:30 in the morning in the coordinated universal time zone (UTC), which is indicated by the Z. Other time zones are represented by the time difference from UTC, so for example you can represent 6:00 in the morning on December 25th 2007 in Pacific Standard Time (which is 8 hours behind UTC) with the value 2007-12-25T06:00:00:000-8:00.<br />The XML Schema specification defines the time zone component of the dateTime, date and time data types as optional. However, in SQL Server 2005 you must provide a time zone for dateTime, time and date data. Additionally, SQL Server 2005 does not preserve the time zone information for your data for dateTime or time, but normalizes it to UTC (so for example, if your XML contains the value 2007-12-25T06:00:00:000-8:00, SQL Server 2005 normalizes this as 2007-12-25T14:00:00:000Z.) In SQL Server 2008, these limitations have been removed, so you can omit the time zone information when you store dateTime, date or time data, and any time zone information that you do provide is preserved.<br />Union and List Types<br />You can use XML schemas to define data types for your XML data that allow a limited set of values to be assigned to multi-value elements and attributes. For example, you might define a sizeListType type that restricts the list of possible values that can be assigned to an AvaliableSizes element in the product definition to S, M, and L. SQL Server 2005 supports XML schemas that contain these simple type definitions and restrictions. For example, you can use a list type to define the valid sizes for a product as shown in the following example.<br /><xs:simpleType name=quot;
sizeListTypequot;
><br /> <xs:list><br /> <xs:simpleType><br /> <xs:restriction base=quot;
xs:stringquot;
><br /> <xs:enumeration value=quot;
Squot;
/><br /> <xs:enumeration value=quot;
Mquot;
/><br /> <xs:enumeration value=quot;
Lquot;
/><br /> </xs:restriction><br /> </xs:simpleType><br /> </xs:list><br /></xs:simpleType><br />This schema declaration enables you to create an element that lists all of the sizes in which a product can be purchased as a list of values separated by white space, as shown in the following example:<br /><AvailableSizes>S M L</AvailableSizes><br />However, what if you want to support two different ways to express the size of a product? For example, suppose a cycling equipment retailer sells cycling clothes in small, medium, and large sizes, but also sells bicycles in numerical sizes relating to the frame size (such as 18, 20, 22, and 24)? To enable you to accomplish this, SQL Server 2008 adds support for union types that contain list types, which you can use to merge multiple list type definitions and restrictions into a single type. For example, the following Transact-SQL code creates an XML schema collection that defines a productSizeType type in which valid values include a list of numeric sizes (18, 20, 22, and 24) and a list of named sizes (S, M, and L).<br />CREATE XML SCHEMA COLLECTION CatalogSizeSchema AS<br />N'<?xml version=quot;
1.0quot;
encoding=quot;
UTF-16quot;
?><br /><xs:schema xmlns:xs=quot;
http://www.w3.org/2001/XMLSchemaquot;
><br /><xs:simpleType name=quot;
productSizeTypequot;
><br /><xs:union><br /><xs:simpleType><br /> <xs:list><br /><xs:simpleType><br /> <xs:restriction base=quot;
xs:integerquot;
><br /><xs:enumeration value=quot;
18quot;
/><br /><xs:enumeration value=quot;
20quot;
/><br /><xs:enumeration value=quot;
22quot;
/><br /><xs:enumeration value=quot;
24quot;
/><br /> </xs:restriction><br /></xs:simpleType><br /> </xs:list><br /></xs:simpleType><br /><xs:simpleType><br /> <xs:list><br /><xs:simpleType><br /> <xs:restriction base=quot;
xs:stringquot;
><br /><xs:enumeration value=quot;
Squot;
/><br /><xs:enumeration value=quot;
Mquot;
/><br /><xs:enumeration value=quot;
Lquot;
/><br /> </xs:restriction><br /></xs:simpleType><br /> </xs:list><br /></xs:simpleType><br /></xs:union><br /></xs:simpleType><br /></xs:schema>'<br />With this declaration in the schema, any elements based on the productSizeType can contain either kind of list; so both of the product elements in the following example would be valid instances of the productSizeType data type.<br /><Catalog><br /> <Product><br /> <ProductName>Road Bike</ProductName><br /> <AvailableSizes>22 24</AvailableSizes><br /> </Product><br /> <Product><br /> <ProductName>Cycling Jersey</ProductName><br /> <AvailableSizes>S M L</AvailableSizes><br /> </Product><br /></Catalog><br />Similarly, SQL Server 2008 supports schema declarations for list types that contain union types.<br />XQuery Enhancements<br />SQL Server 2005 introduced the xml data type, which provides a number of methods that you can use to perform operations on the XML data stored in a column or variable. Most of the operations you can perform use XQuery syntax to navigate and manipulate the XML data. The XQuery syntax supported by SQL Server 2005 includes the for, where, order by, and return clauses of the so called FLWOR expression, which you can use to iterate over the nodes in an XML document and return values.<br />SQL Server 2008 adds support for the let clause, which is used to assign values to variables in an XQuery expression such as the following example:<br />declare @x xml<br />set @x=<br />'<Invoices><br /><Invoice><br /><Customer>Kim Abercrombie</Customer><br /><Items><br /><Item ProductID=quot;
2quot;
Price=quot;
1.99quot;
Quantity=quot;
1quot;
/><br /><Item ProductID=quot;
3quot;
Price=quot;
2.99quot;
Quantity=quot;
2quot;
/><br /><Item ProductID=quot;
5quot;
Price=quot;
1.99quot;
Quantity=quot;
1quot;
/><br /></Items><br /></Invoice><br /><Invoice><br /><Customer>Margaret Smith</Customer><br /><Items><br /><Item ProductID=quot;
2quot;
Price=quot;
1.99quot;
Quantity=quot;
1quot;
/><br /></Items><br /></Invoice><br /></Invoices>'<br />SELECT @x.query(<br />'<Orders><br />{<br />for $invoice in /Invoices/Invoice<br />let $count :=count($invoice/Items/Item)<br />order by $count<br />return<br /><Order><br />{$invoice/Customer}<br /><ItemCount>{$count}</ItemCount><br /></Order><br />}<br /></Orders>')<br />This example returns the following XML.<br /><Orders><br /><Order><br /><Customer>Margaret Smith</Customer><br /><ItemCount>1</ItemCount><br /></Order><br /><Order><br /><Customer>Kim Abercrombie</Customer><br /><ItemCount>3</ItemCount><br /></Order><br /></Orders><br />Note that SQL Server 2008 does not allow the assignment of constructed elements.<br />XML DML Enhancements<br />As well as being able to use XQuery expressions to perform operations on XML data, the xml data type supports the XML DML expressions insert, replace value of, and delete through its modify method. You can use these XML DML expressions to manipulate the XML data in an xml column or variable.<br />SQL Server 2008 adds support for using an xml variable in an insert expression to insert XML data into an existing XML structure. For example, suppose an xml variable named @productList contains the following XML:<br /><Products><br /> <Bike>Mountain Bike</Bike><br /> <Bike>Road Bike</Bike><br /></Products><br />You could use the following code to insert a new bike into the product list:<br />DECLARE @newBike xml<br />SET @newBike = '<Bike>Racing Bike</Bike>'<br />SET @productList.modify<br />('insert sql:variable(quot;
@newBikequot;
) as last into (/Products)[1]')<br />After running this code, the @productList variable would contain the following XML.<br /><Products><br /> <Bike>Mountain Bike</Bike><br /> <Bike>Road Bike</Bike><br /> <Bike>Racing Bike</Bike><br /></Products><br />Conclusion<br />SQL Server 2008 builds on the already comprehensive support for XML that was present in SQL Server 2005, and extends your ability to build powerful database solutions that combine relational data and XML. The improvements to XML schema support, as well as the enhancements to the xml data type provide benefits that application developers will find immensely appealing.<br />For more information:<br />http://www.microsoft.com/sql/<br />Please give us your feedback:<br />Did this paper help you? Tell us on a scale of 1 (poor) to 5 (excellent), how would you rate this paper and why have you given it this rating? For example:<br />Are you giving it a high rating because it has good examples, excellent screenshots, clear writing, or another reason? <br />Are you giving it a low rating because it has poor examples, fuzzy screenshots, unclear writing?<br />This feedback will help us improve the quality of white papers we release. Send feedback.<br />