How to convert TIMESTAMP values to VARCHAR in T-SQL as SSMS does?
问题 I am trying to convert a TIMESTAMP field in a table to a string so that it can be printed or executed as part of dynamic SQL. SSMS is able to do it, so there must be a built-in method to do it. However, I can't get it to work using T-SQL. The following correctly displays a table result: SELECT TOP 1 RowVersion FROM MyTable It shows 0x00000000288D17AE . However, I need the result to be part of a larger string. DECLARE @res VARCHAR(MAX) = (SELECT TOP 1 'test' + CONVERT(BINARY(8), RowVersion)