XML and Databases
Microsoft SQL Server
Microsoft SQL Server tools in Stylus Studio can greatly simplify XML related development tasks for working with SQL Server and XML:
Tools support for DataDirect XQuery™ (an embeddable XQuery engine), you can connect to SQL Server and query it using XQuery programs. One advantage to using DataDirect XQuery™ as opposed to the built-in Microsoft XQuery is that SQL Server's XQuery does not implement the full specification, but just a portion. For example, the let part (the L in FLWOR) isn't supported. (For a whole list of what isn't supported in SQL Server XQuery, see Non-Supported Features and Workarounds.)
Using the File Explorer, it's easy to add a new reference to an XQuery data source. Just right-click on Relational DB and choose New Server. Populate the dialog with the login information, like this:
And you can just drag your datasources right onto the editing canvas to create a new collection. Our example here is using a SQL Server 2005 instance running on a machine named stylus.
(click to enlarge)
Once you've connected to the database, it is a simple matter to use this data source in publishing, as the next point shows.
These queries are very powerful, because they take advantage of the underlying optimizations of the database engine. Literally decades of research and testing has gone into refining the querying algorithms of SQL, and serious databases like Microsoft SQL Server have build upon this knowledge.
DataDirect works closely with database vendors to determine exactly which queries will produce the best performance. When you write your XQuery, it is decomposed and analyzed, and optimal SQL is what is sent through the database driver.
What you write is standard XQuery, and what Microsoft's XQuery doesn't supply, we supply. And if a portion of their implementation is slightly different, we mask the difference. And if they have a proprietary feature which can improve performance, under the covers we will take advantage of that feature.
This means what you put together never has to stoop to vendor-specific slang, but can remain pure — and more importantly, portable. Even if you decide to stay with SQL Server, occasionally new syntax is added, or a new, more efficient way of expressing a query is available. Using the DataDirect XQuery™ engine will ensure that whether you are using SQL Server 2000, 2005 as in this example, or some future version, your query will be insulated from changes and simultaneously will take advantage of whatever optimizations are available on the underlying platform.
XQueries don't just have to stand alone; they can also be embedded in XML Pipelines for multi-stage extractions and transformations.
Just dragging the from the File Explorer to the XML Report data sources pane makes it available for use in publishing from XML.
The XML Report module lets you draw your output on the screen, and then generate XSLT 1.0, XSLT 2.0 or XQuery 1.0 that will in turn generate HTML+CSS or XSL-FO. You can then use that generated code in your own applications, or as part of an XML Pipeline to accomplish more complicated operations.
SQL Server Magazine Readers Choice Award Two Years Running
Because using Stylus Studio® will let you bridge the relational and XML worlds with sophisticated yet transparent tools such as the XQuery Mapper and the XQuery-to-SQL translation middleware DataDirect XQuery™.