SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Guru dale_burrell's Avatar
    Join Date
    Aug 2002
    Location
    Wellington, New Zealand
    Posts
    861
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    SQL Server update() function

    SQL Server provides a function 'update()' which can be used in a trigger to test whether the value of a column has changed in this particular transaction.

    However I can't find any documentation on this function.

    Does anyone have a reference for this.

    Just in case someone skims this post, I am not referring to the SQL update statement!!
    If you aren't living life on the edge
    - you're taking up too much space
    Creative Dreaming Ltd / Ask The Local / Amanzi Travel

  2. #2
    Database Jedi MattR's Avatar
    Join Date
    Jan 2001
    Location
    buried in the database shell (Washington, DC)
    Posts
    1,107
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It is pretty easy:
    Code:
    CREATE TRIGGER foo ON tblBar
    FOR UPDATE
    AS
    IF UPDATE( yourColumn )
    BEGIN
      -- Stuff
    END

  3. #3
    SitePoint Guru dale_burrell's Avatar
    Join Date
    Aug 2002
    Location
    Wellington, New Zealand
    Posts
    861
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by MattR
    It is pretty easy:
    Code:
    CREATE TRIGGER foo ON tblBar
    FOR UPDATE
    AS
    IF UPDATE( yourColumn )
    BEGIN
    -- Stuff
    END
    Yeah I know that much - given that I can't find any documentation that mentions it I was wondering if there is anything more to it, cos we noticed some interesting behaviour the other day which we couldn't quite work out.
    If you aren't living life on the edge
    - you're taking up too much space
    Creative Dreaming Ltd / Ask The Local / Amanzi Travel

  4. #4
    Database Jedi MattR's Avatar
    Join Date
    Jan 2001
    Location
    buried in the database shell (Washington, DC)
    Posts
    1,107
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What else is there? Try explaining the problem -- there shouldn't be much else to it.

  5. #5
    SitePoint Guru dale_burrell's Avatar
    Join Date
    Aug 2002
    Location
    Wellington, New Zealand
    Posts
    861
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you aren't living life on the edge
    - you're taking up too much space
    Creative Dreaming Ltd / Ask The Local / Amanzi Travel


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •