The sum of all SQL Server matter that exist,
and the space in which all SQL Server events
occur or could occur.
Welcome to SQL Server Universe.com Sign in | Join | Help
in
Home SS SLUG Forums Articles Photos Downloads

Is Timestamp coloum value is unique ??

Last post 05-26-2008, 18:23 by idalugama@gmail.com. 2 replies.
Sort Posts: Previous
  • Is Timestamp coloum value is unique ??

     05-26-2008, 16:25

    • Joined on 05-16-2008
    • Posts 10
    • Points 0
    • Top 25 Contributor

    hi

    I have a table, and contains one coloum  with timestamp data type,

    so i can retrieve timestamp coloum data by executing following query

    select CONVERT (int, timestamp_coloum ) from MyTable
     

    Query result as follow 

    4003
    4017
    4036
    4041... etc......

    I just want to know is this result ( out put vale after converted timestamp to INT ) is unique for entire Database ???

     

  • Re: Is Timestamp coloum value is unique ??

     05-26-2008, 18:04

    • Joined on 04-02-2007
    • Colombo
    • Posts 21
    • Points 0
    • Top 10 Contributor
      Male

    The short answer to your question is: yes and no.    If you use SELECT INTO using timestamp as part of SELECT list, you will get duplicate entries. Otherwise it will be unique within the database. Each time when you make a change the current timestamp is updated and it will never be used within the database. The timestamp column is binary(8).  So I recommend you to convert it to bigint instead of int.

    However,  the current value will not be changed in anyway, unless you insert or update a row of a table which has timestamp column.

    You can get the current timestamp value using @@DBTS()

     


    G.R.Preethiviraj Kulasingham MCITP: DBA
    http://preethiviraj.blogspot.com/
    Plan Your Work and Work Your Plan!
  • Re: Is Timestamp coloum value is unique ??

     05-26-2008, 18:23

    • Joined on 05-16-2008
    • Posts 10
    • Points 0
    • Top 25 Contributor

    Thanks lot Preethiviraj for you'r reply

    i really going to use this concept in replication environment  

     

    Thanks

    IndikaD 

View as RSS news feed in XML

(Best viewed with a resolution of more than 1024 * 768)

Powered by Community Server, by Telligent Systems