Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

FOR XML Support for the timestamp Data Type

 

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=" />

Community Additions

ADD
Show:
© 2015 Microsoft