XML and Internet Support

Executing Template Files Using HTTP

Writing long SQL queries at the URL can get cumbersome. Instead, templates can be used to specify queries (SQL or XPath). The template file name is specified in the URL. A template is a well-formed XML document containing one or more SQL statements and XPath queries.

Using a template you can:

Template files also enhance security. Because the URLs (and thus the queries in the URL) can be edited, by having the queries stored in a file (template file), you can prevent users from modifying the queries and obtaining information you do not want them to see.

The security is enforced by removing the URL query-processing service on the virtual root and leaving only the Microsoft® SQL Server™ XML ISAPI to process the files and return the result set. The virtual root is registered using IIS Virtual Directory Management for SQL Server utility.

Before templates can be specified in the URL, the virtual name of template type must be created using the IIS Virtual Directory Management for SQL Server utility. For more information, see Using IIS Virtual Directory Management for SQL Server Utility.

See Also

Using IIS Virtual Directory Management for SQL Server Utility

Accessing SQL Server Using HTTP

Retrieving XML Documents Using FOR XML

Using XPath Queries