Just a Quick Question

  • Comprehension fail on my behalf.

    The SQL Guy @ blogspot[/url]

    @SeanPearceSQL

    About Me[/url]

  • ModifiedBy and ModifiedOn do require triggers, but unless there's a reason to just know who changed a row without having any idea what they changed, there's probably not that much value in them.

    i wouldn't advise using triggers for that - not because of all of the usual gump that people spout about not using triggers (they are the devil along with cursors and function :P) , but moreso because the "modified by" column if done at trigger level can only pass through the current username - how many of us have apps that use a single SQL account to log in..... and then user control is performed by a "users" table - yes it's reinventing the wheel , but when building an app the first thing a developer does is "CREATE TABLE USERS"

    if you force your devs to perform all f their CRUD actions through stored procs then you should be putting the modified date/modified by in via the proc (ie extra parameter for "USERID" )

    MVDBA

  • michael vessey (5/8/2012)


    if you force your devs to perform all f their CRUD actions through stored procs then you should be putting the modified date/modified by in via the proc (ie extra parameter for "USERID")

    So then what about people who bypass the app and connect straight to the DB? Or that other little app that uses the data that you don;t know about?

    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
  • those are the people that are logging in using "SA" ??? - so your trigger will mark the record as update by "SA" - (i'm not for one minurte advocating anyone log in as sa, but it happens!!!)

    the only people going in and modifying your data should be dev/dba people who need to take responsibility for their data mods and update the audit trail appropriatly - but sticking SA in the modified by column doesn't really help - typically these columns are used to audit the end users interaction with the row of data

    MVDBA

  • ...not because of all of the usual gump that people spout about not using triggers (they are the devil along with cursors and function

    ...

    I'm an atheist. Are you afraid of devil cursors, sorcerer's functions or heretic triggers? What about lightning and thunder?

    If you know what they are, how and when to use them, you don't need to be afraid of antique mythology...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • Eugene Elutin (5/8/2012)


    ...not because of all of the usual gump that people spout about not using triggers (they are the devil along with cursors and function

    ...

    I'm an atheist. Are you afraid of devil cursors, sorcerer's functions or heretic triggers? What about lightning and thunder?

    If you know what they are, how and when to use them, you don't need to be afraid of antique mythology...

    Lol Eugene... Im a pantheist .. I beleive in everything.. In particular everything has its place! ive used cursors in very elegant solutions and all those other satanic tools 😛

    I am afraid of lightning though - does that make me a bad dba?

    MVDBA

Viewing 6 posts - 16 through 20 (of 20 total)

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