varchar to timestamp/bigint ?

  • I need to convert data in varchar to timestamp or bigint, is it possible ?

    Or else can i use any other technique.

    I tried using cast(varchat_value as timestamp) but it changes the value!

  • I just ran a quick test using cast, it seems to work for me. The timestamp info is just in a different format. Here's what I did for a test. Is this what you were looking for or if not, could you explain a bit further.

    --

    declare @test-2 varchar(5)

    declare @test1 timestamp

    declare @test2 varchar(5)

    set @test-2 = '1ccm'

    set @test1 = cast(@test as timestamp)

    set @test2 = cast(@test1 as varchar(5))

    select @test-2, @test1, @test2

    -- Result --

    ----- ------------------ -----

    1ccm 0x3163636D00000000 1ccm

    (1 row(s) affected)

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply