Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Upsizing GUID to UniqueIdentifier
Message
De
14/09/2005 04:53:42
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
13/09/2005 22:26:09
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Divers
Thread ID:
01049183
Message ID:
01049327
Vues:
32
Hi Charles,
You're the only American in this forum that can speak all the languages I can:) Yet code talks better:
Declare Integer UuidCreate In 'RPCRT4.dll' String @pguid
Declare Integer StringFromGUID2 In 'Ole32.dll' ;
  string rguid, String @lpsz, Integer cchMax

Select MyUniqueID() as PKID, * ;
	from customer ;
	into table c:\temp\test
Close Databases all

* Upsize
local lnHandle
lnHandle=SQLStringConnect('DRIVER=SQL Server;SERVER=cetin;Trusted_connection=Yes')
SQLExec(m.lnHandle,'Create database [VFPUIDTest]')
SQLExec(m.lnHandle,'use [VFPUIDTest]')
Text to m.lcUpsize textmerge noshow

Create Table FromVFPCustomer (
   pkid uniqueidentifier not null,
   customerID varchar(6) not null,
   company varchar(200) not null,
   contact varchar(100) not null )
Insert into FromVFPCustomer (pkid, customerID,company,contact)
   select PkID,cust_id,company, contact 
   from OPENROWSET('VFPOLEDB',
			'c:\Temp\';'';'',
			'select * from "c:\Temp\Test"')
endtext	

SQLExec(m.lnHandle,m.lcUpsize)
SQLDisconnect(m.lnHandle)

Function MyUniqueID
Local pGUID,rGUID,cGUID
pGUID=Replicate(Chr(0),16)
rGUID=Replicate(Chr(0),80)

cGUID = Iif(Inlist(UuidCreate(@pGUID),0,1824),;
  Iif(StringFromGUID2(m.pGUID,@rGUID,40) # 0, ;
  Strconv(Left(m.rGUID,76),6), ""),"")
Return Chrtran(m.cGUID,'{}','')
Cetin

>Kardeşim
>
>Perhaps I don't understand your answer. I have a vfp table I want to convert to a sql server table. My char(36) field looks exactly like what I see in a uniqueid field, but in using either DTS through the vfpoledb driver or going from VFP to SQL with the upsizer I do not seem to have the option of telling SQL I want this information to be seen as a uniqueid.
>
>I have been able to use this field information with SPT and it does indeed match values in sql. My remote views generate these keys on the front end and they are accepted by sql with no problem.
>
>I am just lazy and looking for an easy way to convert existing VFP tables to SQL tables and not have to manually change the char(36) fields in sql to uniqueid.
>
>Sağol
>
>>
>>Charles,
>>I didn't use upsizing but with SPT and alike SQL server recognizes 36,38 bytes versions, 16 bytes version and strconv(x,15) version.
>>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
Répondre
Fil
Voir

Click here to load this message in the networking platform