Reply to Re: Beginner question: find or create function

Your name:

Reply:


Posted by Robert Klemme on 01/19/07 09:36

Please don't top post.

On 18.01.2007 21:47, Plamen Ratchev wrote:
> I agree on the performance note and use of SCOPE_IDENTITY(), I was just
> trying to simplify things and illustrate better the steps.

With all due respect, don't you think my solution is simpler or at least
as simple? There's not really a difference in complexity between
SCOPE_IDENTITY() and @@IDENTITY and your solution needs one more SQL
statement. :-)

> But if there is
> concurrent activity this better be in a transaction, as even in your example
> if siteID is NULL by the time you insert it there might be another insert
> with the same siteName and the statement will result in error.

Of course all this must be in a transaction - how would you execute the
code without TX at all, especially since it's in a stored procedure?

> And not an
> issue with uniqueness for siteName as it was indicated there is unique
> constraint on it.

Ah, thanks! I hadn't seen that.

Regards

robert

[Back to original 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

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