You are here: Re: Equivalent to SQL Anywhere GET_IDENTITY? « MsSQL Server « IT news, forums, messages
Re: Equivalent to SQL Anywhere GET_IDENTITY?

Posted by Jim C on 11/28/06 15:13

Nope, ident_current() won't work for me because it does not reserve the
next autoinc value. It just peeks at what was inserted last. The help
says it "Returns the last identity value generated for a specified
table or view in any session and any scope." I can not see how it
could reliably be used to reserve the next autoinc value in a
multi-user system because by the time you read the value, increment it,
and insert a new record another session could easily have read the same
value and inserted a row with the value you're about to insert.

The application does its own autoinc-like stuff now but fails with a
modern sql server because it relies on the old database engine's very
different locking methods. I think what I'll explore now is getting
the id source column to be read and written inside a serializable
transaction.

Erland Sommarskog wrote:
> The function ident_current() is the one you are looking for, but the value
> it returns is global to all processes, so if you call ident_current(),
> insert a row and then look at scope_identity() you may see a different
> value, if another process was at it at the same time.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация