How to make the SQL Server database support XML

Source: Internet
Author: User

If you work in it, you probably have heard of XML, but if your job is primarily about SQL Server, you may not be using XML directly. XML is already a popular data format in the Web programming environment, and it is one of the main underlying technologies in the. NET framework. SQL Server supports XML in two ways: through the capabilities of SQL Server itself, and by publishing additional functionality called SQLXML. SQLXML extends SQL Server and provides XML compatibility.

SQL Server support for XML means that we can update and read data more effectively; We no longer need to convert XML data into another format that the database can understand, or convert XML data from a database into XML. And there are more options available for developers to choose from, which means they are more flexible in accessing data.

There's been a lot of hype about XML, so it's important to realize that it's just a simple technique. In essence, it is a standard file format used to describe data. Since the initial release of SQL Server 2000, support for XML is already part of SQL Server. Instead of providing a way to save XML files to support XML, SQL Server provides an interface to relational data that allows you to read and write XML data in tables and other database objects. The XML features inherent in SQL Server include: You can access SQL Server through HTTP, template queries, FOR XML clauses, and OPENXML () functions. Next, I'll tell you how these functions work and how they can benefit your business.

Figure 1. Provide XML support

To access a SQL Server database via HTTP, you must first set up a virtual directory. This virtual directory provides a link between the HTTP protocol and a specific database. When setting up a virtual directory, we need to use the "Configure SQL XML Support in IIS" menu entry, which you can find in the SQL Server menu entry in the window's Start menu. With this menu entry, you can specify the name of the virtual directory, the physical path, the server name, the database name, and the registration information. Once you create a virtual directory, you can send the query to the database via a URL. If you set up a virtual directory called Northwind and entered a query in the browser/northwind?sql=select+*+from+shippers+for+xml+auto,elements+&root= Shippers, it returns XML data similar to the shippers example in the XML 101 toolbar. HTTP queries make it easier for us to access data for a Web site or Web application than to use ADO or any other technology.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.