Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Random 10 Char Values
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Divers
Thread ID:
01017716
Message ID:
01017735
Vues:
17
Hi,

SQL Server does this automatically for you. Actually, the return value of NEWID() is a 16-byte value that is automatically casted to a string when you use it in a string function such as REPLACE(). If you create a uniqueidentifier field, it only consumes 16 bytes as in the following sample:

CREATE TABLE Test (ID uniqueidentifier DEFAULT NewID(), cValue varchar(30))
INSERT INTO Test (cValue) VALUES ('one')
INSERT INTO Test (cValue) VALUES ('two')
INSERT INTO Test (cValue) VALUES ('three')
SELECT * FROM Test
--
Christof
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform