in reply to mssql query
Er, just a minor point not directly related, but I think you want to do that _right_after_ the insert. In other words not as two seperate calls to the DBI object. I do it something like this:
my ($index)=$dbh->selectrow_array('insert into foo (bar,baz) values (1 +,2) select @@identity');
I think if you do it as a do() and as a select() seperately the @@identity will be cleared. Or you can set up a stored proc and then have the stored proc return the identity after the insert for you.
BTW, the @@identity only exists on Sybase and MSSql to the best of my knowledge.
First they ignore you, then they laugh at you, then they fight you, then you win.
-- Gandhi
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: mssql query
by mpeppler (Vicar) on Dec 01, 2003 at 16:25 UTC | |
by demerphq (Chancellor) on Dec 02, 2003 at 00:08 UTC | |
|
Re: Re: mssql query
by l3nz (Friar) on Dec 01, 2003 at 14:43 UTC | |
by mpeppler (Vicar) on Dec 01, 2003 at 16:32 UTC |