共用方式為


將 XSD 資料類型對應至 XPath 資料型態 (SQLXML 4.0)

適用於:SQL ServerAzure SQL 資料庫

針對 XSD 架構執行 XPath 查詢,並在 xsd:type 屬性中 指定 XSD 類型 時,XPath 會使用處理查詢時指定的數據類型。

節點的 XPath 數據類型衍生自架構中的 XSD 數據類型,如下表所示。 (EmployeeID 節點用於圖例目的。

XSD 數據類型 XDR 資料類型 對等

XPath 數據類型
SQL Server

使用的轉換
Base64Binary

HexBinary
None

bin.base64bin.hex
不適用

EmployeeID
布林值 boolean boolean CONVERT(bit, EmployeeID)
Decimal, integer, float, byte, short, int, long, float, double, unsignedByte, unsignedShort, unsignedInt, unsignedLong number, int, float,i1, i2, i4, i8,r4, r8ui1, ui2, ui4, ui8 number CONVERT(float(53), EmployeeID)
id、idref、idrefsentity、entities、notation、nmtoken、nmtokens、DateTime、string、AnyURI id、idref、idrefsentity、entities、enumeration、notation、nmtoken、nmtokens、char、dateTime、dateTime.tz、string、uri、uuid string CONVERT(nvarchar(4000), EmployeeID, 126)
decimal fixed14.4 不適用 (XPath 中沒有相當於固定 14.4 XDR 數據類型的數據類型。 CONVERT(money, EmployeeID)
date date string LEFT(CONVERT(nvarchar(4000), EmployeeID, 126, 10)
time time

time.tz
string SUBSTRING(CONVERT(nvarchar(4000), EmployeeID, 126, 1 + CHARINDEX(N'T', CONVERT(nvarchar(4000), EmployeeID, 126)), 24)