• R.P.Rozema (7/23/2012)


    Then while you're at it, don't use getdate() for the timestamp on your audit data and don't use current_timestamp either. Instead I suggest to use getutcdate().

    Using getutcdate() ensures that a) your audit trail won't be broken when daylight saving time changes (UTC does not have day light saving). And b) when the data is moved from one timezone into another -for example by replicating the data into a server on another continent- the audit information will be unambigous.

    Good point RP!

    Too many of us operate in our own little worlds (call them time zones if you prefer). In Thailand, we only have one time zone and no daylight savings time. So I'm safe from all but the pundits. 😀


    My mantra: No loops! No CURSORs! No RBAR! Hoo-uh![/I]

    My thought question: Have you ever been told that your query runs too fast?

    My advice:
    INDEXing a poor-performing query is like putting sugar on cat food. Yeah, it probably tastes better but are you sure you want to eat it?
    The path of least resistance can be a slippery slope. Take care that fixing your fixes of fixes doesn't snowball and end up costing you more than fixing the root cause would have in the first place.

    Need to UNPIVOT? Why not CROSS APPLY VALUES instead?[/url]
    Since random numbers are too important to be left to chance, let's generate some![/url]
    Learn to understand recursive CTEs by example.[/url]
    [url url=http://www.sqlservercentral.com/articles/St