SQL Server 2000 透過 IIS 虛擬目錄管理工具,支援以 HTTP/HTTPS 直接執行查詢、模板、XPath 等操作,回傳 XML 文件或片段,適合 Web 整合、跨平台呼叫場景。
https://IISServer/nwind?sql=SELECT+*+FROM+Customers+FOR+XML+AUTO&root=root
FOR XML AUTO 回傳 XMLroot 參數指定單一根元素,否則回傳 XML 片段https://IISServer/nwind?template=SELECT+*+FROM+Customers+FOR+XML+AUTO
https://IISServer/nwind/TemplateVirtualName/templatefile.xml
https://IISServer/nwind/SchemaVirtualName/schemafile.xml/Customer[@CustomerID="ALFKI"]
CREATE VIEW + SQL 查詢template、schema、dbobjectroot 參數 → 完整 XML 文件(含 BOM,如 0xFF 0xFE 表 Unicode)root 參數 → XML 片段(無 BOM、無標題)URL 執行涉及臨時表、游標、sp_xml_preparedocument 等資源時,必須在同一批次中配對釋放(DROP TABLE、DEALLOCATE、sp_xml_removedocument),否則會造成記憶體洩漏。