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. tow stored procedure

tow stored procedure

Scheduled Pinned Locked Moved Database
helpdatabase
4 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.
  • Y Offline
    Y Offline
    yazan_zahi
    wrote on last edited by
    #1

    i have tow stored procedure i put them in one procedure the 1fst have the primary key idntity value the seconed have the forign key how ican solve the problem by passing the value to the 2nd procedure ================================= i will pass th procedure to u : create procedure ks_media_item_full_data @Item_No int, @Desc nvarchar(200), @added_date datetime, @Added_by nvarchar(100), @content ntext, @textlength int as execute dbo.Ks_Ins_Media_Item @Item_No, @Desc, @added_date, @Added_by execute dbo.Ks_Ins_Media_Item_content @Item_no,@content, @textlength ======================================== can you help me pls fast yazan

    _ 1 Reply Last reply
    0
    • Y yazan_zahi

      i have tow stored procedure i put them in one procedure the 1fst have the primary key idntity value the seconed have the forign key how ican solve the problem by passing the value to the 2nd procedure ================================= i will pass th procedure to u : create procedure ks_media_item_full_data @Item_No int, @Desc nvarchar(200), @added_date datetime, @Added_by nvarchar(100), @content ntext, @textlength int as execute dbo.Ks_Ins_Media_Item @Item_No, @Desc, @added_date, @Added_by execute dbo.Ks_Ins_Media_Item_content @Item_no,@content, @textlength ======================================== can you help me pls fast yazan

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

      In the first stored procedure insert the record and then get the new value if identity using @@IDENTITY and pass this value to the second stored procedure. BTW why you are using two stored procedure for this do the work of the second stored procedure in the first one itself.

      Best Regards, Apurva Kaushal

      Y 1 Reply Last reply
      0
      • _ _AK_

        In the first stored procedure insert the record and then get the new value if identity using @@IDENTITY and pass this value to the second stored procedure. BTW why you are using two stored procedure for this do the work of the second stored procedure in the first one itself.

        Best Regards, Apurva Kaushal

        Y Offline
        Y Offline
        yazan_zahi
        wrote on last edited by
        #3

        my DBA wants that sorry i do not undrstand can you send the sentax to me pls and thank you alot

        _ 1 Reply Last reply
        0
        • Y yazan_zahi

          my DBA wants that sorry i do not undrstand can you send the sentax to me pls and thank you alot

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

          what you have to do is to first insert the record in the table. Then put @@IDENTITY in a local variable like this: @TempVar = @@IDENTITY this line will be there just after the insert statement. And then you can pass this local variable(@TempVar) to the second stored procedure.

          Best Regards, Apurva Kaushal

          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