We have converted a database from SQL Server 2000 to SQL Server 2014. We require XML output and use T-SQL's for xml explicit
option to return XML.
The timestamp value has been preserved during the conversion. i.e. A conventional query returns the timestamp value 0x00000000057A12B8
on both servers.
When using for xml explicit the SQL Server 2014 output is <Ts>AAAAAAV6Erg=</Ts>
and the SQL Sever 2000 output is <Ts>91886264</Ts>
Can anybody explain the difference?
First of all: Congratulations! You will be happy without SQL Server 2000!
Second:
SELECT ... FOR XML EXPLICIT
is outdated and should be (in almost all cases) replaced with calls ofSELECT ... FOR XML PATH('xyz')
. This gives you much better control and a very intuitive approach.Now to your question:
As you surely now,
TIMESTAMP
is - other than ANSI-SQL, where it is the same a T-SQL'sDATETIME
- a binary type, better used with the synonymROWVERSION
to avoid confusions.SQL Server 2014 will implicitly convert binary data to
base64
to let you include this within an XML (text based).Try this:
The numeric value you've got is just the decimal number to express the same value:
With this query
you would get the number - if you need it...