Getting New RecID after SQL INSERT
Ruslan Zasukhin
sunshine at public.kherson.ua
Fri Aug 20 18:26:17 CDT 2004
On 8/20/04 5:04 PM, "Ivan Smahin" <IvanSmahin at public.kherson.ua> wrote:
> FS> Usually they have a SQL way to do that. For instance in MySQL it is:
>
> FS> SELECT LAST_INSERT_ID()
>
> FS> In Sybase, you can use:
>
> FS> SELECT @@IDENTITY
>
> FS> This ability is especially important for stored procedures.
>
>
> FS> Best regards.
> FS> Frank
>
> FS> _______________________________________________
> FS> Valentina mailing list
> FS> Valentina at lists.macserve.net
> FS> http://lists.macserve.net/mailman/listinfo/valentina
>
> Please note, you have no ability to get the last inserted id as result
> of sql-insertion anyway.
>
> Definitely, this stuff is usual for SPs.
> But for now I think it could be something like this:
>
> select max(REC_ID) ....
No Ivan, this will not work.
Do not forget about wholes from deleted records.
> Or more correctly...
> Following normalizing rules you need to have PK or uniqie field for
> each table.
Ivan, this is in RDBMS model,
but this is not required in Valentina model !
> So what is the problem to:
> select REC_ID from YOUR_TABLE where UNIQUE_FIELD = inserted_value
>
> Do I miss something?
Yes. I will explain you later.
--
Best regards,
Ruslan Zasukhin [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan at paradigmasoft.com
web: http://www.paradigmasoft.com
To subscribe to the Valentina mail list go to:
http://lists.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------
More information about the Valentina
mailing list