Before leaning FOR XML PATH option and XQuery, today, we'll learn about XPath Expression. This post will go over some XPath terminologies. Next post we'll look at the XPath syntax and work through some examples. If you want to learn more about XPath, please read the W3C XPath documentation here. W3schools website also has a good tutorial here. Xpath (XML Path Language) Is a standard for define path to element in XML fragments/documents. Like a query language for XML Expressed in hierarchical way (like path in UNIX file system) Used in XQuery, XSLT, Xpointer, XML Schema Level are delimited with / character By default every column are element Prefix the column alias with @ character to covert column to attribute-centric formatting. XPath Nodes: Root Element Attribute Text Namespace Comment...
On the last post, the examples aggregate data with single level (group by customers). Today we'll explore how to aggregate data with multiple levels in XQuery. For the example below, we'll use the same orders.xml document. <?xml version="1.0"?> <orders> <order orderid="1"> <custid>1</custid> <orderdate>2014-05-15</orderdate> <shipaddress> <address>343 2nd Ave S.</address> <city>Seattle</city> <region>WA</region> <postalcode>98142</postalcode> </shipaddress> <items> <item itemid="a1"> <quantity>1</quantity> <unitprice>10.00</unitprice> </item> </items> <subtotal>10.00</subtotal> </order> <order orderid="2"> <custid>2</custid> <orderdate>2014-06-01...
This post is for those that are brand new to SQL Server. I will guide you through how to set up a test environment for your database learning. After completing this tutorials you will have a SQL Server 2012 instance on your computer along with a sample database. Step 1: You can download a 180 day trial version of SQL Server 2012 here , or spent $40 to get the developer version with all the feature here . Step 2: Follow this instruction from Andy Leonard to install a default SQL Server Instance on your computer. Note make sure you follow this instruction exactly or else instruction on step 5 won't work. Step 3: Download a copy of the AdventureWorks database here . This database will be used for your learning. Step 4: Read the instruction below to launch SQL Server Management Studio(SSMS): Windows 7: go to Start menu > All Programs > Go to "Microsoft SQL Server 2102" folder > launch SQL Server Management Studio Windows 8: on your keyboard press this...
Comments
Post a Comment