Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
sureshkumar
Starting Member
11 Posts |
Posted - 2004-08-15 : 09:33:56
|
| Hi I want to generate a autonumber in the employee tableeg :empcode varchar(50)empcode : 000001through stored procedure .Any one please help meThanks and regardssuresh kumar.A |
|
|
gpl
Posting Yak Master
195 Posts |
Posted - 2004-08-15 : 11:27:03
|
| why not use an identity and cast it to a varchar when you return it ? |
 |
|
|
sureshkumar
Starting Member
11 Posts |
Posted - 2004-08-15 : 12:23:12
|
| Thanks Now i made it as identity.whether can i display that number in the asp page while generate new record.if possible how we can generate |
 |
|
|
gpl
Posting Yak Master
195 Posts |
Posted - 2004-08-15 : 14:28:59
|
| You will need to return the newly generated Identity as an output param (@@Identity)So the sequence goes something like thisuser selects 'Enter a new record'page is displayeduser fills in formuser presses submitthe form values are passed to a stored procedure that does the insert, immediately after the insert statement, Set your output parameter to @@Identityreturn the output param to your asp, or return the whole record to your asp page in update modedoes this help ??Graham |
 |
|
|
derrickleggett
Pointy Haired Yak DBA
4184 Posts |
Posted - 2004-08-15 : 18:09:16
|
| INSERT table(field) VALUES('value') --If you have an identity column and a column called field.SELECT SCOPE_IDENTITY() --You should use this instead of @@IDENTITY.MeanOldDBAderrickleggett@hotmail.comWhen life gives you a lemon, fire the DBA. |
 |
|
|
sureshkumar
Starting Member
11 Posts |
Posted - 2004-08-16 : 10:29:13
|
| Thanks |
 |
|
|
|
|
|