Timestamp from String

  • Hi I have a table with Timestamp column named TS

    I want to filter the table based from TS

    I try with

    SELECT Code, Description, TS FROM IItem 
    where TS = '00000000006094BC'

    But didn't work.

    How I can solve it?

  • What do you mean it didn't work? At a guess, if you defined the column as timestamp(which by the way is deprecated, you should be using rowversion instead), you should be defining the input value as a binary value:

    SELECT Code,
    Description,
    TS
    FROM IItem
    WHERE TS = 0x00000000006094BC;

    For your original query, '00000000006094BC' would have been implicitly cast to binary(8), resulting in the clause WHERE ts = 0x3030303030303030.

    • This reply was modified 4 years, 10 months ago by  Thom A.

    Thom~

    Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
    Larnu.uk

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

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