適用対象: SQL Server
Azure SQL Database
Azure SQL Managed Instance
FOR XML
変換では、timestamp 型の値は varbinary(8) データとして扱われ、常に Base 64 エンコードされます。 要求された場合、XML スキーマ定義 (XSD) または XML-Data Reduced (XDR) スキーマにはこの型が反映されます。
DROP TABLE t;
GO
CREATE TABLE t (
c1 INT,
c2 TIMESTAMP
);
GO
INSERT t VALUES (1, NULL);
GO
SELECT * FROM t
FOR XML AUTO, XMLDATA;
GO
結果セットは次のとおりです。
<Schema name="Schema1" xmlns="urn:schemas-microsoft-com:xml-data" xmlns:dt="urn:schemas-microsoft-com:datatypes">
<ElementType name="t" content="empty" model="closed">
<AttributeType name="c1" dt:type="i4" />
<AttributeType name="c2" dt:type="bin.base64" />
<attribute type="c1" />
<attribute type="c2" />
</ElementType>
</Schema>
<t xmlns="x-schema:#Schema1" c1="1" c2="AAAAAAAACGE=" />