Rich
|
Posted: 05/11/2004, 5:48 AM |
|
I have a table with identity column. I want to query the databas for that identity column value to insert it into another table.
In SQL, you can run the following:
select @@identity and it will give you the value.
I can't seem to get this select to work on the after execute insert option
there is no where clause, or from clause
Any help is appreciated
|
|
|
peterr
Posts: 5971
|
Posted: 05/11/2004, 7:18 AM |
|
I think that you shouldn't need a WHERE or FROM clause.
We have an example in CCS Example Pack. Search the "ManyToManyCheckbox" page for the text "'Retrieve the last inserted key".
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
|
|
Stefano Chermaz
|
Posted: 05/12/2004, 6:42 AM |
|
You must use the same connection object of the query insert
In Codecharge, if your connection name is Connection1 you can use
SQLIdentity="SELECT @@IDENTITY as id"
Set RecordSet1 = DBConnection1.Execute(SQLIdentity)
YourVariable=Recordset1("id")
If Recordset1.State = adStateOpen Then _
Recordset1.Close
Set Recordset1 = Nothing
|
|
|
|