No data in Timestamp field

  • I would have hoped the timestamp field would be automatically populated when a new row is added. Do I need a line of code in VB6? If so, can you help with the line? Thanks.

  • Hi gmg,

    no, normally timestamp should be automatically added when a new row is inserted.

    Have you check through QA?

    Cheers,

    Frank

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

  • No, but I will now. Thanks.

  • well, i've been unsuccesful in finding out why my newly created timestamp field does not have data on new records. Help 🙂

  • I'm sorry, perhaps the binary explains why I can't see in view. Thanks.

  • Hi,

    And don't forget - Timestamp has nothing to do with date/time - it is simply a integer, incremented by one, on each row insert and update in a database.

    Cheers, Peter

  • this is probably a stupid question but did you remember to uncheck allow nulls on the time stamp field ?

  • Hi adamrogas,

    quote:


    this is probably a stupid question but did you remember to uncheck allow nulls on the time stamp field ?


    when you only create the field and leave everything else by default allow nulls is not checked.

    Cheers,

    Frank

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

  • That is odd, I just did it, in SQL 2000 and allow nulls is checked by default. with out doing any thing.

  • hmm,...

    quote:


    That is odd, I just did it, in SQL 2000 and allow nulls is checked by default. with out doing any thing.


    my test box is SQL7. That's it. On SQL2k I get the same result as you.

    Cheers,

    Frank

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

  • quote:


    hmm,...

    quote:


    That is odd, I just did it, in SQL 2000 and allow nulls is checked by default. with out doing any thing.


    my test box is SQL7. That's it. On SQL2k I get the same result as you.

    Cheers,

    Frank


  • I just tried the following code in SS2k SP3. Timestamp behaves by incrementing each time a record is added or updated.

    use tempdb

    -- drop table dbo.t1

    create table dbo.t1(c1 int NULL, c2 timestamp NULL)

    insert dbo.t1(c1)

    select id from dbo.sysobjects

    select * from dbo.t1

    update dbo.t1 set c1 = c1

    select * from dbo.t1

    Notice that the timestamp values are created on the insert and that they change following an update, even if the values don't change on the update.

    hth,

    joe

  • Default for you timpstamp filed to (getdate()). This will get ther Now time and date when inserting new record.

Viewing 13 posts - 1 through 12 (of 12 total)

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