Getting number of record added 
Author Message
 Getting number of record added
Hi

I have a stored proceedure that creates a new record in an invoice table
using Insert
The invoice table uses an indentifier to automatically increase the record
number of the invoice table

Is there anyway that I can get hold of the identifier number of the new
record added to the invoice table within the same proceedure as I need to
assign it immediately to
a foreign key in a different table which holds order information

Regards

Mark



Sun, 19 Jun 2005 01:47:59 GMT
 Getting number of record added

Quote:

> I have a stored proceedure that creates a new record in an invoice table
> using Insert
> The invoice table uses an indentifier to automatically increase the record
> number of the invoice table

> Is there anyway that I can get hold of the identifier number of the new
> record added to the invoice table within the same proceedure as I need to
> assign it immediately to
> a foreign key in a different table which holds order information

If you are on SQL2000, use the function scope_identity(). If you are

generated identity value, but scope_identity has the additional

generated in a trigger that was fired by the INSERT statement.
scope_identity is only available on SQL2000.

--

I support PASS - the definitive global community for SQL Server
professionals - http://www.sqlpass.org



Sun, 19 Jun 2005 05:34:46 GMT
 
 [ 2 post ] 

 Relevant Pages 

1. add record with identity number before any existing number

2. Find certain Number of Records / Print only certain number of records

3. getting the ID of newly added record

4. dbase4 file format: getting the number of records

5. How to add a record number field to a view

6. Adding Record Numbers to Reports

7. getting the number of records from a ResultSet

8. Getting/Setting Record Number in VB4 Tables?

9. getting primary key of the last record added

10. Adding ID numbers to existing records

11. Getting Access Current Record Number in Visual Basic

12. troubles getting the ID after adding a record


 
Powered by phpBB® Forum Software