Databases Reference
In-Depth Information
Creating well-formed XML data
In this step, we will create XML data from a SQL Server 2012 table.
1.
In SSMS, run the following query against the Northwind database:
SELECT TOP 6 [CustomerID],[CompanyName],[Address],[City],[Country]
,[Phone]
FROM [Northwind].[dbo].[Customers]
For XML RAW
2.
In the Results pane, click on the only hyperlink.
When you retrieve data from a SQL Server using the
For XML clause, the result is usually in the form of a
link to an XML document.
3.
Then, copy the data to Notepad. The data should appear as shown in the
following query:
<row CustomerID="ALFKI" CompanyName="Alfreds Futterkiste"
Address="Obere Str. 57" City="Berlin" Country="Germany"
Phone="030-0074321" />
<row CustomerID="ANATR" CompanyName="Ana Trujillo Emparedados y
helados" Address="Avda. de la Constitución 2222" City="México
D.F." Country="Mexico" Phone="(5) 555-4729" />
<row CustomerID="ANTON" CompanyName="Antonio Moreno Taquería"
Address="Mataderos 2312" City="México D.F." Country="Mexico"
Phone="(5) 555-3932" />
<row CustomerID="AROUT" CompanyName="Around the Horn" Address="120
Hanover Sq." City="London" Country="UK" Phone="(171) 555-7788" />
<row CustomerID="BERGS" CompanyName="Berglunds snabbköp"
Address="Berguvsvägen 8" City="Luleå" Country="Sweden"
Phone="0921-12 34 65" />
<row CustomerID="BLAUS" CompanyName="Blauer See Delikatessen"
Address="Forsterstr. 57" City="Mannheim" Country="Germany"
Phone="0621-08460" />
We will use the above data when we create a data source in Report Builder.
The query we use in creating the data source is shown in the next step.
4.
Embed this block of XML data between the tags shown here:
<Query>
<XmlData>
<rows>
 
Search WWH ::




Custom Search