Share via


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

適用於:SQL ServerAzure SQL Database

當 XPath 查詢針對 XSD 架構執行,並在 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 中沒有相當於 fixed14.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)