FOR XML support for the timestamp data type
Applies to: SQL Server Azure SQL Database Azure SQL Managed Instance
In the FOR XML transformation, timestamp type values are treated as varbinary(8) data and will always be base 64 encoded. The XSD or 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
This is the result:
<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="AAAAAAAAH04=" />
See also
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for