Hello,
I apologise if this question has been asked before but I have searched forums and the web and have not found a solution. I am current creating a script that has a cursor that builds a sql statement to be executed e.g.
--code within cursor
SELECT'
DECLARE @.Result INT
EXEC @.Result = DELETE_DOCUMENT
@.DocumentID = ' + STR(DocumentID) + ',
@.TimeStamp =' + CAST([Timestamp] as varchar) + ',
-- CHECK RESULT AND STATUS
-- IF OK LOG IN META_BATCH ELSE LOG ERROR' AS SQL
FROMDocument
The problem I am having is trying to join the timestamp column into the sql string. I have tried to cast the time stamp to a varchar but I end up with the following output for the timestamp column values
T
T?
T-
xnT
T!
T"
T#
T$
T%
T&
T'
T(
T)
T*
T+
T,
instead of
0x0000000013540F1C
0x0000000013540F1E
0x0000000013540F1F
0x0000000013786EDE
0x0000000013540F21
0x0000000013540F22
0x0000000013540F23
0x0000000013540F24
0x0000000013540F25
0x0000000013540F26
0x0000000013540F27
0x0000000013540F28
0x0000000013540F29
0x0000000013540F2A
0x0000000013540F2B
0x0000000013540F2C
which would not allow my delete script to work correctly. So I would really appreciate some advice to a pointer to where I might find out how to convert the timestamp.
Thanks
Sam
use tempdb
go
create table dbo.t1 (
c1 timestamp
)
go
insert into dbo.t1 default values
go
select
c1,
master.sys.fn_varbintohexstr(cast(c1 as varbinary(8)))
from
dbo.t1
go
drop table dbo.t1
go
AMB
|||hi
Thanks for that I have been looking for that kind of function every where
Regards
Sam
No comments:
Post a Comment