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 |
|
Pinto
Aged Yak Warrior
590 Posts |
Posted - 2004-09-17 : 06:14:28
|
I have a sql table, tblParams, with a field called NextReqNo. Using a stored procedure I want to get the number in NextReqNo, add 1 to it, update the table, and then pass the new value to a text box on an asp.net web page.I want to do this in a stored procedure.Can anyone help me with this please. Please make it simple - I am a newbie  |
|
|
rockmoose
SQL Natt Alfen
3279 Posts |
Posted - 2004-09-17 : 06:33:43
|
| This tblParams, does it only contain 1 row with the last used NextReqNo ?ordoes it contain a list of all the used NextReqNo ?- In that case an update to the table doesn't make sense, an insert would.rockmoose/* Chaos is the nature of things...Order is a lesser state of chaos */ |
 |
|
|
Pinto
Aged Yak Warrior
590 Posts |
Posted - 2004-09-17 : 07:15:18
|
| It just has the last used number in it - 1 row |
 |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2004-09-17 : 07:24:39
|
this should help:declare @NextReqNo intupdate tblParamsset @NextReqNo = NextReqNo + 1, NextReqNo = @NextReqNoreturn @NextReqNoGo with the flow & have fun! Else fight the flow |
 |
|
|
Pinto
Aged Yak Warrior
590 Posts |
Posted - 2004-09-17 : 09:21:39
|
Brilliant - thank you so much I had to change it slightly (also I simplified the names for my posting)CREATE PROCEDURE spRMU_GetNextRequestNo@NextReqNo int OUTPUTasupdate tblCounterTableset @NextReqNo = NextRequestNo + 1,NextRequestNo = @NextReqNoreturn @NextReqNoGO |
 |
|
|
|
|
|