Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Identity Column
Message
De
03/04/2000 14:30:42
 
 
À
03/04/2000 09:38:03
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Conception bases de données
Titre:
Divers
Thread ID:
00352537
Message ID:
00354470
Vues:
22
Fetching PKs is a very common solution to the problem that you've mentioned. A very popular solution is to have a table that contains the next key value and a stored procedure to fetch/update it.
CREATE TABLE ID (token varchar(40), nextid integer)
GO
CREATE PROCEDURE GetNextId
 @table varchar(40), @id integer OUTPUT
AS
 UPDATE id
 SET @id = nextid, nextid = nextid + 1
 WHERE token = @table
 
 RETURN 0
GO
-Mike
Michael Levy
MCSD, MCDBA
ma_levy@hotmail.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform