Less Than Dot is a community of passionate IT professionals and enthusiasts dedicated to sharing technical knowledge, experience, and assistance. Inside you will find reference materials, interesting technical discussions, and expert tips and commentary. Once you register for an account you will have immediate access to the forums and all past articles and commentaries.
Your profile
Tag cloud
.net asp.net asp.net mvc azure book bug business intelligence c# cloud computing database excel functions gemini google gotcha how to howto iis indexing interview jquery kanban linq madison measurement mvc nhibernate nunit performance programming rhino mocks security silverlight sql sql friday sql server sql server 2000 sql server 2005 sql server 2008 sql server 2008 r2 sqlserver structuremap t-sql tip trick unit testing vb.net vista visual studio 2010 windows 7
Authors
- SQLDenis (269)

- chrissie1 (200)

- onpnt (96)

- George Mastros (35)

- Alex Ullrich (24)

- tarwn (17)

- naomi (9)

- thatrickguy (8)

- damber (7)

- emtucifor (7)

- ca8msm (7)

- chopstik (6)

- More...
Main Categories
Search
Google Ads
Tags: xml
If you use the FOR XML syntax in SQL Server it can be a little tricky to get the XML formatted the way you really want it.
For every table that you have in a join it becomes a child of the table before. What if you have a 3 table join and you want one table to be the parent and the two tables that you are joining to be on the same level, I will show you how you can accomplish that.
First let's create some tables and insert some data
You have a table and you would like to create a XSD schema based on that table. What is the easiest way to do that in SQL Server? The easiest way to do that would be to use FOR XML syntax with AUTO, ELEMENTS and XMLSCHEMA. If your table is named test and you want your schema to be named TestXsdSchema then you would do the following
How to import a bunch of XML files from a directory in T-SQL
A couple of days ago onpnt posted the following blogpost: Import directory of XML files into SQL Server 2005
In that post he was using SQLCLR to import a bunch of files. Some of you might not be so familiar with .NET so I am providing a T-SQL way to do something similar
You will need to create a directory testxml on the c drive and put a bunch of XML files in there. If you don't have any XML files then save the following two as file1.xml and file2.xml
...
So you want to spit out some XML from SQL Server into a file, how can you do that? There are a couple of ways, I will show you how you can do it with SSIS. In the SSIS package you need an Execute SQL Task and a Script Task.
Let's get started
First create and populate these two tables in your database


LTD Social Sitings
Note: Watch for social icons on posts by your favorite authors to follow their postings on these and other social sites.