Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
GUID/UniqueIdentifier Upsizing Wizard
Message
De
13/07/2009 17:07:49
Dieter J. Vogel
Ingenieurbuero Vogel
Muenster, Allemagne
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
GUID/UniqueIdentifier Upsizing Wizard
Divers
Thread ID:
01412058
Message ID:
01412058
Vues:
95
Hi,
have to transfer VFP-data to MS-SQL. Also have to change from incrementing primary keys to GUIDS. Wrote a routine, that adds columns to existing tables and put GUIDS in. Getting crazy because I don't know how to store GUIDS in Fox-tables. Using the following code to get the GUIDS (Source: http://www.berezniker.com):
FUNCTION GenerateGUID
LOCAL lcGUID, lcStrucGUID, lnSize
lcStrucGUID = SPACE (16)
lcGUID = SPACE (78)
lnSize = LEN(lcGUID)/2

IF CoCreateGuid(@lcStrucGUID) <> 0
RETURN ""
ENDIF

IF StringFromGUID2(lcStrucGUID, @lcGuid, lnSize) = 0
RETURN ""
ENDIF

&& VFP 8.0 and later
RETURN STREXTRACT(STRCONV(lcGUID,6), "{", "}")
&& Previous versions
&&RETURN CHRTRAN(STRCONV(lcGUID, 6), "{}" + CHR(0), "")
ENDFUNC


FUNCTION CoCreateGuid(tcStrucGUID)
DECLARE INTEGER CoCreateGuid IN Ole32.dll STRING @cGUIDStruc
RETURN CoCreateGuid(@tcStrucGUID)
ENDFUNC


FUNCTION StringFromGUID2(tcStrucGUID, tcGuid, tnSize)
DECLARE INTEGER StringFromGUID2 IN Ole32.dll STRING cGUIDStruc, STRING @cGUID, LONG nSize
RETURN StringFromGUID2(tcStrucGUID, @tcGuid, tnSize)
ENDFUNC
Tried c(36)-fields (without {}), c(38)-fields (with {}) and varbinary q(16)-fields. The stupid SEDNA-wizard never changes to UniqueIdentifier as the target-field type. Can anybody tell me how to store the GUIDS in Fox-tables so the Upsizing-Wizard realizes to use a UniqueIdentifier-field?

TIA
-Dieter aus Münster
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform