@@DBTS

  • Comments posted to this topic are about the item @@DBTS

  • oops!! thought the checkboxes where radio buttons.

    "Keep Trying"

  • ChiragNS (9/23/2009)


    oops!! thought the checkboxes where radio buttons.

    Same for me. Would have been better to add "select all that apply" to the question, like it is normally done.

  • Me too... never occurred to me I could choose multiple items.

  • In SQL 2008 Books online I find under @@DBTs:

    Returns the value of the current timestamp data type for the current database. This timestamp is guaranteed to be unique in the database.

    So I think it's strange that answer b is wrong.. don't think it's a good question if books online says different from your 'correct' answer.

    Also in books online:

    Examples

    The following example returns the current timestamp from the AdventureWorks database.

    Copy Code

    USE AdventureWorks;

    GO

    SELECT @@DBTS

  • This question is badly written, .. B is the most correct answer

  • wim.buyens (9/23/2009)


    In SQL 2008 Books online I find under @@DBTs:

    Returns the value of the current timestamp data type for the current database. This timestamp is guaranteed to be unique in the database.

    So I think it's strange that answer b is wrong.. don't think it's a good question if books online says different from your 'correct' answer.

    In SQL 2005 books online is mentioned under remarks:

    @@DBTS returns the last-used timestamp value of the current database. A new timestamp value is generated when a row with a timestamp column is inserted or updated.

  • I agree - the question should have said click all that apply and then we might have thought "I wonder if there is more than the obvious answer from BOL".

  • Me too! Didn't spot the tick boxes until too late. Didn't see anything that matched the 2nd answer either. Not a happy bunny !!! :crying: More tea needed.

    How do I apply for a refund ...

  • ChiragNS (9/23/2009)


    oops!! thought the checkboxes where radio buttons.

    And me. I even looked up the answer in BOL, as I'd never heard of the function, and so got the same only-partly-correct answer as it gives there.

    At least the QotD has achieved it's purpose of teaching me something (though I suspect I'll quickly forget it again!)

  • Mark_Pratt (9/23/2009)


    How do I apply for a refund ...

    Well, if you can convince the coach of Oregon that your wrong answer was associated with the Ducks loss at Boise State, you might get something...

    http://thequad.blogs.nytimes.com/2009/09/21/check-please-coach-kelly/

  • I have edited the question. I'll award back points to this time now.

  • I don't understand how it could return both the current and the last timestamp used. According to MSDN, @@DBTS returns the last-used timestamp value of the current database. A new timestamp value is generated when a row with a timestamp column is inserted or updated.

    This means that it's the last timestamp used -- not the current time stamp.

    http://msdn.microsoft.com/en-us/library/ms187366.aspx

    I even tested it and if it was the current time stamp, it would change every time you ran the select command. It stays the same until a row is updated or inserted that contains a timestamp column.

  • Steve is correct to award points. While testing the script indicates only answer #3 is correct. it's possible to find Microsoft documentation supporting answer 2 and also supporting answer 3.

    The confusion is easy to understand. I too had never heard of @@DBTS, so I ran the script. It obviously wasn't returning the data type.

    Then I looked it up in BOL. Both 2000 and 2005 BOL are absolutely clear in stating

    Returns the value of the current timestamp data type for the current database. This timestamp is guaranteed to be unique in the database.

    .

    It is equally clear in the Remarks on the same page that

    @@DBTS returns the last-used timestamp value of the current database. A new timestamp value is generated when a row with a timestamp column is inserted or updated.

    and in the Example area -

    The following example returns the current timestamp from the AdventureWorks database.

    The URL to the MSDN Library page leads to supporting answer 3 as well.

    Thanks Microsoft - :hehe:

    Tom Garth
    Vertical Solutions[/url]

    "There are three kinds of men. The one that learns by reading. The few who learn by observation. The rest of them have to pee on the electric fence for themselves." -- Will Rogers
  • I think it's a case of interpretation.

    It first states that it:

    Returns the value of the current timestamp data type for the current database. This timestamp is guaranteed to be unique in the database.

    Then in the remarks:

    @@DBTS returns the last-used timestamp value of the current database. A new timestamp value is generated when a row with a timestamp column is inserted or updated.

    If you think of the current timestamp as the last one currently in use, it makes sense. I agree it could have been phrased much better, but I think that may have been what they were thinking.

    You could then use this as a way of checking that the timestamp column in a given table was updating properly without actually looking at the table itself.

Viewing 15 posts - 1 through 15 (of 22 total)

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