I need to use the Identity value of a an inserted record, to insert in another table. The insertions are done using stored procedures, which are called from a winforms button event. Procedures are parameterised, so i can't execute the first procedure in another procedure
Procedure [dbo].[insert_trans] (
@name nvarchar(50),
@email nvarchar(50),
@ata_certification bit,
@St1 nvarchar(50),
@St2 nvarchar(50),
@City nvarchar(MAX),
@State nvarchar(MAX),
@Country nvarchar(MAX),
@Zipcode numeric(18, 0),
@Qualification nvarchar(50),
@Interpreting_service bit ,
@Tran_Int_Degree bit,
@Total_Experience int,
@Native_language nvarchar(50),
@Resume bit
) as
begin
insert into Location_Master (
St1,
St2,
City,
State,
Country,
Zipcode
) values (
@St1,
@St2,
@City,
@State,
@Country,
@Zipcode)
Declare @Location_id int
set @Location_id = (SELECT CAST(SCOPE_IDENTITY() AS varchar(10))
AS LAST_IDENTITY)
insert into Translators values (
@name,
@email,
@ata_certification,
@Location_id,
@Qualification,
@Interpreting_service,
@Tran_Int_Degree,
@Total_Experience,
@Native_language,
@Resume)
end
and the second procedure, where I require the sno generated
procedure insert_langknown (
@translator_id int,
@Language_code varchar(50)
) as
begin
Insert into Language_known (
translator_id,
Language_code
) values (
@translator_id,
@Language_code)
end
The translator id is the required field