Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Returning newid(()
Message
De
30/12/2014 07:56:42
 
 
À
29/12/2014 14:16:56
Timothy Bryan
Sharpline Consultants
Conroe, Texas, États-Unis
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Stored procedures, Triggers, UDFs
Versions des environnements
SQL Server:
SQL Server 2012
Application:
Desktop
Divers
Thread ID:
01612793
Message ID:
01612829
Vues:
59
>I am using GUID values for all primary keys in an application. I am also using only stored procedures for all data access including inserts or updates. If I set newid() as the default of a column, then it gets added on insert. The question is how can I select back that row after the insert if I do not know the ID value? I suspect there is a means within a stored procedure insert to do this, but not sure of the function.
>
>If I was using incremented integers, I could use this I think.
>WHERE ([tablePK] = SCOPE_IDENTITY())
>
>What can I use for Guids?

For the common use case to use GUIDs is when IDs have to be generated client side - in which case the question evaporates ;-)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform