Using Timestamp column in select statement

  • I have a timestamp column in a table and I want to select the row using the value in the timestamp column. When I select all columns/rows I get values similiar to the following: 0x00000000000140A7

    However when I use that value to select a specific row:

    Select * from mytable where timestampcol = '0x00000000000140A7'

    The error message "Implicit conversion from data type varchar to timestamp is not allowed. Use the CONVERT function to run this query."

    however when I use the following statement:

    select * from mytable

    where timestampcol = convert(timestamp,'0x00000000000140A7' )

    No row is returned (and the timestamp has not changed, I made sure)

    What select statement can I use to retrieve the row using the timestamp value?

    TIA,

    James.

    -=JLK=-

  • 0x00000000000140A7 is a number in hex notation. don't enclose it in quotes.

    Select * from mytable where timestampcol = 0x00000000000140A7

  • Duh! :w00t: Thanks! Sometimes I need the obvious pointed out to me.

    -=JLK=-

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

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