tow stored procedure
-
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
-
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
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
-
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
my DBA wants that sorry i do not undrstand can you send the sentax to me pls and thank you alot
-
my DBA wants that sorry i do not undrstand can you send the sentax to me pls and thank you alot
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