Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Identity column question
Message
 
 
À
10/09/2003 12:26:11
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Conception bases de données
Divers
Thread ID:
00827797
Message ID:
00828037
Vues:
15
>I found the paragraph that you're quoting from:
>
>
> However, identity columns are no panacea. Retrieving the last value is normally handled by checking the value of the @@IDENTITY global variable. But it may be difficult to get the correct value of this variable, as insert triggers might have caused other identity columns to be incremented and thus would return the wrong value for @@IDENTITY. Identity columns can also cause a problem when databases are replicated. If you have the choice, you should avoid identity columns when you design a database. Learn to use them, though, because you may find yourself working on databases that use them.
>
>When this book was written, SQL Server 2000 had not been released. SQL Server 2000 has added a couple of functions that make using identity columns a little easier to use. Specifically I'm referring to the SCOPE_IDENTITY() function. Now, I think that you'll find that this function works based when used from within a stored procedure.
>
>And speaking stored procedures, I belong to the "stored procedure" camp. All data access is done using stored procedures, no ad-hoc queries.
>

Thank you very much for the explanation and for suggestion with "stored procedures".
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform