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. Query regarding SP's

Query regarding SP's

Scheduled Pinned Locked Moved Database
sharepointdatabasehelp
5 Posts 3 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.
  • P Offline
    P Offline
    ParagGupta
    wrote on last edited by
    #1

    If suppose we have to add a row in a table, using insert and there is a primary key(PKID) which is auto incremented. After executing the SP how will we know that what being the value of that key, i.e. to retrieve it from the SP itself, i had heard that there is a particular command for that Can someone help me plz................

    _ 1 Reply Last reply
    0
    • P ParagGupta

      If suppose we have to add a row in a table, using insert and there is a primary key(PKID) which is auto incremented. After executing the SP how will we know that what being the value of that key, i.e. to retrieve it from the SP itself, i had heard that there is a particular command for that Can someone help me plz................

      _ Offline
      _ Offline
      _AK_
      wrote on last edited by
      #2

      If you want to get the PKID(auto incremented) then you can use @@IDENTITY for that. This will give you the PKID of just inserted recored. :)

      Best Regards, Apurva Kaushal

      P 1 Reply Last reply
      0
      • _ _AK_

        If you want to get the PKID(auto incremented) then you can use @@IDENTITY for that. This will give you the PKID of just inserted recored. :)

        Best Regards, Apurva Kaushal

        P Offline
        P Offline
        ParagGupta
        wrote on last edited by
        #3

        I didn't get your reply and what I soppose that you fine mine question unclear So let me clarify it I am asking that Suppose there is an SP that store some information Inserted by user and it generate automatically an ID (identity element) for that particular information. Now after calling this SP in some of the function I want the PKID that is assigned to recent information, How can I retrive this PKID ??

        S 1 Reply Last reply
        0
        • P ParagGupta

          I didn't get your reply and what I soppose that you fine mine question unclear So let me clarify it I am asking that Suppose there is an SP that store some information Inserted by user and it generate automatically an ID (identity element) for that particular information. Now after calling this SP in some of the function I want the PKID that is assigned to recent information, How can I retrive this PKID ??

          S Offline
          S Offline
          sa Eish
          wrote on last edited by
          #4

          Do a select statement using this: SELECT IDENT_CURRENT('table_name') This will return the last inserted PK in the table or SELECT @@IDENTITY Try sql help on these two functions and see how they work exacly:-D

          P 1 Reply Last reply
          0
          • S sa Eish

            Do a select statement using this: SELECT IDENT_CURRENT('table_name') This will return the last inserted PK in the table or SELECT @@IDENTITY Try sql help on these two functions and see how they work exacly:-D

            P Offline
            P Offline
            ParagGupta
            wrote on last edited by
            #5

            Oh fine and Thanku vary much Mr. Devil and Mr. Apurva

            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