I have not really made use of stored procedures in the past but now find myself needing to.
I have a table TABLE1 which has an IDENTITY field as the PRIMARY KEY. The table structure is as follows :
IDX int IDENTITY,
Field1 char(10),
Field2 int,
Field3 char(20)
I need my stored procedure to INSERT a new entry into the TABLE1 (passing it the values for Field1, Field2 + Field3) but need it to return the newly utilised IDX column. This value for IDX needs to be made use of when INSERT'ing into my next table.
How can this be done ?
Any help would be appreciated.
Thanks in advance.
I have a table TABLE1 which has an IDENTITY field as the PRIMARY KEY. The table structure is as follows :
IDX int IDENTITY,
Field1 char(10),
Field2 int,
Field3 char(20)
I need my stored procedure to INSERT a new entry into the TABLE1 (passing it the values for Field1, Field2 + Field3) but need it to return the newly utilised IDX column. This value for IDX needs to be made use of when INSERT'ing into my next table.
How can this be done ?
Any help would be appreciated.
Thanks in advance.