|
Home > Archive > Microsoft SQL Server forum > June 2005 > Stored Procedure
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| Christian Büttner 2005-06-29, 11:23 am |
| Hi
i need a stored procedure in an sql server, that inserts a query and
returns a int value. the int value is an id made of a auto increment
(identity(1,1) field.
i have no clue how to do that.
| |
| vjdileo 2005-06-29, 8:24 pm |
| / ********************
**************
Here's a simple version of how it's done, but I recommend
that you read the following article I found to give
yourself a better idea of the issues you're dealing with:
http://www.clevercomponents.com/art...lgenerators.asp
hth,
victor dileo
********************
**************/
create procedure idnum_test
as
BEGIN
create table #test ( idnum int identity(1,1), mydata char(5) )
insert #test( mydata )
values ('aa')
insert #test( mydata )
values ('ab')
select * from #test
select @@identity
END
exec idnum_test
/ ********************
*/
Christian B=FCttner wrote:
> Hi
>
> i need a stored procedure in an sql server, that inserts a query and
> returns a int value. the int value is an id made of a auto increment
> (identity(1,1) field.
>=20
> i have no clue how to do that.
|
|
|
|
|