Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How can I use Globally Unique IDentifier (GUID)
Message
De
04/11/2004 09:28:17
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00958008
Message ID:
00958066
Vues:
17
>Hi All,
>how can i use which is belows described issue on my tables like newid()
>
>http://support.microsoft.com/support/kb/articles/Q269/3/87.asp
>
>TIA

In your database create a new function say GUID():
function GUID()
Local pGUID,rGUID
Declare Integer UuidCreate In 'RPCRT4.dll' String @pguid
Declare Integer StringFromGUID2 In 'Ole32.dll' ;
  string rguid, String @lpsz, Integer cchMax

pGUID=Replicate(Chr(0),16)
rGUID=Replicate(Chr(0),80)

Return Iif(Inlist(UuidCreate(@pGUID),0,1824),;
  Iif(StringFromGUID2(pGUID,@rGUID,40) # 0, ;
  Strconv(Left(rGUID,76),6), ""),"")
endfunc
Set your PK default value to GUID() - requires c(38). Original value is a 128bits integer which you might store in c(16). Check fox4um.com.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform