Category Archives: SQL Server

Using Excel to help with Data formatting (SQL Scripts)

(Download Excel Spreadsheet example at the bottom.) Sometimes when developing I need to work with data. Sometimes this data is from external sources such as other partners in the business. Unfortunately when I get this data does not follow a consistent format therefore I’m left with formatting it for entry into a data store, usually…

HOWTO: Build a Store Locator in ASP.NET

Full Visual Studio 2005 solution included at the bottom of this post. Update 2008-12-31: Fixed a bug with the variable equality. Updated to the source on the codeplex site: codeplex.com/StoreLocator  Update 2008-11-22: Fixed a bug with the variable definition. Also Moved the source code to CodePlex. From now on, all updates to the source will…

Updated: Formatted XML From SQL

In my previous post I showed you how to return XML from the SQL Server Database. To further this topic, you can also format your XML to use Xml elements. This time, we’re going to take a list of Customers and view their orders along with some information from the order, thats right, its straight…

Generate XML in SQL

You can easily generate Xml from a DataTable by using the .WriteXml() method. But you can also bypass this and retrieve the Xml directly SQL Server 2005 by running the following command: USE Northwind; SELECT    EmployeeID,        LastName,        FirstNameFROM    dbo.EmployeesFOR XML AUTO;   This will return an Xml representation of the data that looks like this: <dbo.Employees EmployeeID=”1″ LastName=”Davolio” FirstName=”Nancy” /><dbo.Employees EmployeeID=”2″…