Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Applies to:
SQL Server
Azure SQL Database
Azure SQL Managed Instance
SQL database in Microsoft Fabric
In the FOR XML transformation, timestamp type values are treated as varbinary(8) data, and is always Base64 encoded. The XML Schema Definition (XSD) or XML-Data Reduced (XDR) schema, if requested, reflects this type.
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
Here's the result set.
<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=" />