Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. How to get the PK value within an update trigger

How to get the PK value within an update trigger

Scheduled Pinned Locked Moved Database
databasetutorialannouncement
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    ScottM1
    wrote on last edited by
    #1

    Hi Within an update trigger I am trying to get the value of the primary key of the row that fired the trigger. I can't select the primary key using any of the other columns either since the other columns may be duplicated in rows other than the one that fired the trigger. Thanks

    There are 10 types of people in the world, those who understand binary and those who dont.

    P 1 Reply Last reply
    0
    • S ScottM1

      Hi Within an update trigger I am trying to get the value of the primary key of the row that fired the trigger. I can't select the primary key using any of the other columns either since the other columns may be duplicated in rows other than the one that fired the trigger. Thanks

      There are 10 types of people in the world, those who understand binary and those who dont.

      P Offline
      P Offline
      Pete OHanlon
      wrote on last edited by
      #2

      If you are using Sql Server, you can select the value from the deleted table in your trigger. Trust me - it sounds strange, but it does work.

      Deja View - the feeling that you've seen this post before.

      My blog | My articles

      S 1 Reply Last reply
      0
      • P Pete OHanlon

        If you are using Sql Server, you can select the value from the deleted table in your trigger. Trust me - it sounds strange, but it does work.

        Deja View - the feeling that you've seen this post before.

        My blog | My articles

        S Offline
        S Offline
        ScottM1
        wrote on last edited by
        #3

        Thanks, That worked Cheers

        There are 10 types of people in the world, those who understand binary and those who dont.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups