Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Upsizing GUID to UniqueIdentifier
Message
From
16/09/2005 07:53:39
 
 
To
16/09/2005 04:16:13
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
01049183
Message ID:
01050201
Views:
100
>But don't forget if you use c(36 or 38) version do not use nocptrans. Directly definable as uniqueidentifier without that flag.

I'm not sure about this part. I use c(36) nocptrans with the flag and everything is good. Without the flag, the conversion fails.

I think that once the data being transfered is in the proper format at 36 or 38 ( i.e. with or without the brackets ) it doesn't matter if the nocptrans is set. If the 36 or 38 is formatted properly as a character string, DTS sees it as a unique id. I just tested sending one over without nocptrans and DTS treated it exactly the same the one with nocptrans.

VFE also creates GUID(16) ( C(16) nocptrans ) using an algorhythm that was orginally, I think, written by Rick Strahl. They just look like a 16 char string with no dashes ( - ) DTS will only eat those if the NOCPTRANS is set. As C(16) character fields they are the wrong size

( BTW, I didn't know these GUID(16)s could be converted this way! I thought I had to change field size and reformat them, padding them out. This is very cool! Hard to learn about these things using the VFP upsizing 'wizard' ( a sorcerer's apprentice at best ) since it does not even offer the option of uniqueid as a data type for conversion )

Also very interesting the weird looking project that is created by the upsizing wizard if you ask it to generated code. Buried in there are sql scripts. I would think by now someone in the fox community would have written something to allow for search and replace mods on the memo fields storing the scripts followed by using those scripts with execsql to do a more sophisticated upsizing.

I wish the DTS wizard would recognize the PK of the VFP table and make it unnecessary to hack the transform script, though. That is one thing the VFP upsizer wizard actually knows how to do.



>PS: I don't know VB:) All I can do is to understand and modify VB code. I never understood why they're always DIMming and never BRIGHTing < bg >.

LOL.


>Cetin
>
>>Yaşa bey !
>>
>>Akılına sağlık.
>>
>>TransformFlags = DTSTransformFlag_ForceConvert
>>
>>is exactly the answer I needed !!! I found the transform flags in the docs but couldn't figure out the vbscript syntax to get it into the transform script.
>>
>>You definitely have more languages than I do ( I figure C, Vbscript, C# and probably 4 or 5 I don't know about beat my Thai, Lao and Bahasa :-)
>>- but I bet we both count in Persian when we play tavla )
>>
>>>c(36) and c(38) versions are not binary (nocptrans). They're plain char fields and directly convertible to uniqueidentifier.
>>>PS: I see DBTYPE_BYTES there. It matches VFP9 VFPOLEDB specicification and would directly convert to DBTYPE_GUID if it were c(16) nocptrans version. At home I had old VFPOLEDB (VFP7)that maps c(16) binary to DBTYPE_STR and I had to use varbinary first). When it's DBTYPE_BYTES a GUID is exactly 16 bytes (16*8=128 bits value).
>>>
>>>Nope it doesn't convert directly and I get conversion error as you said (DTS bug IMHO). To workaround:
>>>
>>>From Transform (...) go to "Transformations" tab. Select "Transform ...." and edit VB script there:
>>>
>>>Under "Function Main()" line add this line:
>>>
>>>TransformFlags = DTSTransformFlag_ForceConvert
>>>
Cetin
>>>
>>>>Okay, this is not the result I am getting so I may have something set wrong in my DTS.
>>>>
>>>>I have the c(38) nocptrans field. I run the DTS wizard. I pick uniqueid for that field.
>>>>
>>>>I run the DTS and I get this error:
>>>>
>>>>DTSTransformCopy: Schema validation failed. See extended error information.
>>>>TransformCopy 'DirectCopyXForm' validation error: ForceConvert not specified but
>>>>required for column pair 13 (source column 'pk_supplier'
>>>>(DBTYPE_BYTES),destination column 'pk_supplier' (DBTYPE_GUID)
>>>>
>>>>Any idea how to specify ForceConvert ?
>>>>
>>>>>Charles,
>>>>>I didn't have VFP and SQL server on this box so it took me sometime to install them and test:)
>>>>>I created a database in VFP with 3 tables in it. Those 3 tables had c(38),c(36) and c(16) nocptrans versions respectively.
>>>>>In SQL server DTS I directly mapped 36,38 ones to uniqueidentifier and 16 bytes one to varbinary(16). All imported sucessfully. After import I changed type of 3rd one to uniqueidentifier.
>>>>>Checked values in both VFP and SQL server and they matched.
>>>>>Cetin
>>>>>
>>>>>>>I think we're losing to be synch in "upsizing".
>>>>>>
>>>>>>Yani, "out of synch" (free English lesson in return for code lesson :-)
>>>>>>
>>>>>>Okay, I think I am starting to get what you are saying. ( still don't understand pguid and rguid as you use them but maybe I don't have to in order to use the function. ) I did understand we were talking about using code on the VFP side to 'upsize' and not to use the wizard.
>>>>>>
>>>>>>I did try converting the c(36) guids to c(38) including the brackets. If I do that the DTS transformation allows me to select UniqueID as the destination data type, but the import fails saying that a forcedconversion is required and I can't find out how to do that. ( will go back and try again on the DTS wizard )
>>>>>>
>>>>>>Let me play some more and I will come back with more questions.
>>>>>>


Charles Hankey

Though a good deal is too strange to be believed, nothing is too strange to have happened.
- Thomas Hardy

Half the harm that is done in this world is due to people who want to feel important. They don't mean to do harm-- but the harm does not interest them. Or they do not see it, or they justify it because they are absorbed in the endless struggle to think well of themselves.

-- T. S. Eliot
Democracy is two wolves and a sheep voting on what to have for lunch.
Liberty is a well-armed sheep contesting the vote.
- Ben Franklin

Pardon him, Theodotus. He is a barbarian, and thinks that the customs of his tribe and island are the laws of nature.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform