how to handle "timestamp" datatype value in sql server

  • Hi,

    I am getting trouble to pass the value of column2 to of my table in SQL stored procedure from .net application (vb.net) and same to compare the input variable's value in the stored procedure,

    create table table_name(

    column1nchar(50)

    ,column2timestamp

    )

    in detail, the data would be like this.

    select top 1 column2 from table_name

    The Result:

    "0x00000000009CEB4F"

    the query would be like this:

    declare @variable nvarchar(max)

    set @variable ='0x00000000009CEB4F'

    select *

    from table_name

    where column2=@variable

    can any one please throw a light on my issue , how can I overcome that,

    any help is much appriciated.

    Thanks,

    Siva

  • How can you overcome what? What exactly is the problem?

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • timestamp is poorly named; the correct datatype name is rowversion.

    it's storing a number in there , not an nvarchar or varchar.

    you could change your variable to be int, bigint, or varbinary to get the resutls you expect.

    declare @variable int

    set @variable =0x000000000002F5D1

    select *

    from table_name

    where column2=@variable

    insert into table_name(column1) VALUES('example')

    /*

    ccolumn1column2 (No column name)

    example 0x000000000002F5D1194001

    */

    select *, convert(int,column2)

    from table_name

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • Hi Gila,

    Thanks for your effort to read my post, but the issue which I thought to overcome, has been suggested by lowell.

    Thanks again,

    Prabhu...

  • Hi Lowell,

    yes, I tested the Idea which you suggested and found it is working, thanks for your valued time,

    Thanks,

    Prabhu...(siva)

Viewing 5 posts - 1 through 4 (of 4 total)

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