April 10, 2009 at 11:41 pm
dear friends
how can i increment a id value in store procedure if id column is primary key on my table
please help me
thanks in advance
jignesh
April 11, 2009 at 2:30 am
Please post the script for the table, this will help to clarify your requirement.
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
April 11, 2009 at 2:59 am
Hi jignesh
If you use an IDENTITY column it will be incremented automatically and you can get the value with SCOPE_IDENTITY() function. If you don't have an IDENTITY column use a ID-table where applications/procedures get their ID-ranges to work with. Avoid a select MAX to determine the next possible ID.
Greets
Flo
April 11, 2009 at 3:40 pm
To add to what Flo stated... if you insert more than one row with an IDENTITY column, you can use OUTPUT to capture all of the IDENTITIES created as a result set.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply