TechEd '04: DAT327 SQL Server 2005 (code named "Yukon"): Inside XQuery
If there was any one session that I felt was must see, its this one.
- XML makes sense to data exchange
- Useful for content management
- Messaging, especially SOAP
- Query status quo
- XPath, mainly navigational, but no reshaping
- Limited data types
- XSLT mainly used for data-driven transformation of XML
- Need a good query and transform
- XQuery: functional, declarative query language
- Provides Xpath and construction
- Can work on typed or untyped data
- Been in the works since 1998.
- The last call working graph is out
- Working is going on full text index. Out of scope for Yukon due to dates
- End of 2005, XQuery in recommendation (no full text nor DML)
- Gave a simple example
- Talked about FLWOR
- Includes XPATH, which is mostly a subset of XQuery
- Order-preserving operators
- XQuery in Yukon will be statically type, strongly typed if schema is
available.
- Schema provides rich structural and provides for the validation of the
query
- XML data modification
- After execuation, you expect consistent results
- Insert might insert anywhere, so a before and after option is
provided
- Delete works on any number of matching nodes, inserts must be
singletons
- Replace is supported too, but must be statically associated with a
single node.
- Showed an example of fetching out the schema that had been shredded and
associated with the column
- Demo of doing an count with XQuery
- .Query method always returns an unbound XML type
- Example of validation from schema. That is very helpful
- Demo of using sql:query and sql:variable and nodes
- Example of using the nodes methods to shred XML in a typed column.
- The name of output tables may be confusing at first
- Talked about modification with the modify method
- It would be easy to get tripped up by the insert behavior if you schema
wanted the node being inserted at a specific location, which will usually be
the case.
- Beta2 is aligned with XQuery Nov. 2003 Last Call Draft
- Added XML Data Modification
- Appled to a single XML data type instance
- For XQuery values, the result must be statically a signleton. SQL type
has to be scalar
- Query generates entitized results.
- No sql:column or sql:variable on XML or CLR UDT types
- Implementation subset
- No let
- No user defined functions
- No XQuery validation
- No expression on constructed nodes
- Dynamic errors are mapped to an empty sequences
- No XQuery joins across differnt XML, but might be able to do this on
the client side
- Exploit type information and use indexeds. Use Xquery for property
promotion.
- Use cast to resolve static type errors
Arpan takes over and talks about XQuery in the framework
- Based on November 2003 XQuery last class
- XQuery and compiles down to MSIL (like XSLT)
- Can use information for XmlSchemaSet
- Can embedded T-SQL in client side code
- You can write additional functionality too
- XML 1.0 can be consumed, as can XMLReader API (XML InfoSet) and
XPathNavigator
- Demos of making dynamic SQL and stored procedure calls
- Demo of calling a Web Service
- DO NOT EXECUTE YOUR JOINS ON THE CLIENT
- Client-side processing exists for legacy stored procedures to XML format
- They've given on rewriting the query when called
Great question, More people needed to be here to start grokking this.