Search - Articles
DevASP.NET for ASP.NET, VB.NET, XML and C# (C-Sharp) Developers Tuesday, March 03, 2009
Dev Articles
Search Directory
ASP.NET
VB.Net
C-Sharp
SQL Server
 

SQL Server 2000 and XML Integration.

Author: Shahzad Latif

SQL Server 2000 tightly integrates with XML. We can get data from SQL Server 2000 in XML format. This article shows you how to get the benefits of SQL Server 2000 and XML Integration.

SQL Server 2000 can accept XML commands via HTTP and SQL OLEDB. XML works with HTTP to relay data via a browser. SQL Server 2000 provides the ability to access SQL Server data through URL.

It provides us a way to query data from SQL Server using xPath queries. These queries can be executed directory in URL or by encapsulating the xPath query in a template and then calling templates from the URL.  In order to get data this way you need to make some settings.

First, you need to enable XML support in IIS fror SQL Server. Click Start -> Programs -> Microsoft SQL Server -> Configure SQL XML Support In IIS. This launches the MMC for virtual directory management in SQL Server.

Next step is to create a virtual directory. Right click the Default Web Site node and select New -> Virtual Directory. It'll open virtual directory property window. On the first tab enter name of the virtual directory i.e. TestVD, and enter a path where you want the file to be placed i.e. D:\Temp\Test.

On the security tab specify login information for your database. Data Source tab allows you to specify a SQL Server instance and the database name.  The next tab allows you to specify a way in which you want to access the virtual root. Here, select the following "Allow URL queries" option.

Now, you can directly query the SQL Server using query like the given.

 Select+*+From+TableName+For+XML+AUTO

Append this query to the URL for the virtual directory that you have created.

http://localhost/TestVD?sql=Select+*+From+TableName+For+XML+AUTO&root=root

 

 

 

 

 

   
Add Article Comment:
Name :
Email Address :
   
Comments :
 
   
<< How to perform date operations in SQL Sever.

Disclaimer - Privacy
© 2002-2017 DevASP.net