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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2002-01-23 : 10:12:11
|
| steve writes "Hi guys, great site.My question is this:I have a stored procedure that i am calling from an asp page. The stored procedure Inserts a new record into database, then I want it to retreive the ID the new column has received. Here is the syntax i am using:------------------------------------------------create procedure myinsert (@mydata varchar)asBegin --insert data Insert into mytable (name) Values (@mydata) --get the new id Select max(id) as theMaxid from mytableend-------------------------------------------------The problem is, on my asp page I say =rs("theMaxId") and I get "... could not locate ordinal...".Now, if I put "Select max(id) + 1 as theMaxid from mytable" before the insert, it works fine.Sorry for such a long question, i guess I was windering if the order of execution would matter in a case like this.thanks a lot,Steve" |
|
|
|
|
|