Lots of people are talking about XML and its potential applications, but where does XML really fit with SQL Server and other business systems? We have plenty of new technologies to learn and business problems to solve without implementing XML just because "everybody's doing it." The exciting news is that we have plenty of good business reasons for using XML. Here are two practical applications you can implement right away.
The first application is for error handling. You often build error handling as a generic component that you can wire into any application at development time. But what happens when one of your applications needs data in a different format than another application? XML provides an easy solution. Just create a column in the database table to hold the data as XML, then feed the XML in the format each application needs. This approach gives you flexibility while letting you use the same structure for all applications. However, the technique does add another layer to your applications, requiring an XML filter to read the data from the table.
The second application is for storing session data. If you use Active Server Pages (ASP) applications to store session data in SQL Server, the database table's structure must support the session data. However, session needs can change frequently as you develop and enhance an application. By storing session data as XML, you can modify the type and amount of session data stored for each application or each part of an application. Just key the session records with a globally unique ID (GUID). (For tips about using GUIDs, see SQL Server Secrets, "Using SQL Server's GUID Feature," SQL Server Magazine UPDATE, March 23.)
XML provides practical solutions for many other application needs, including communication and data conversion between dissimilar applications. To learn more about using XML with SQL Server, stay tuned to this column and make sure you subscribe to the new SQL Server Magazine XML UPDATE at http://www.win2000mag.com/sub.cfm?code=up00sqlxml.