Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Convert c(16) hex to Integer
Message
From
20/11/2008 15:30:23
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Database:
MS SQL Server
Miscellaneous
Thread ID:
01363246
Message ID:
01363329
Views:
19
Hey Dave -

Thanks. I had been thinking along those lines as well since as Sergey said the nature of these keys doesn't really lend itself to straight translation to ints. But the number of tables and number of keys make this no small feat.

Actually later this afternoon I had a breakthrough in realizing how Strataframe actually handles UIDs and it is a lot easier than I thought, so I may not do this conversion, but simply use int identity keys in future stuff (unless I really do anticipate the kind of merging that made guids so useful in my VFP apps. May go to using newsequentialid() in those cases. )

>Charles,
>
>I think I'd do this into a set of staging tables to start, using a native SQL server int identity as the PK. Then you can use INSERT - SELECT with JOINs on the original c(16) keys into the ultimate destination tables carrying forward only the new int PKs as the FKs.
>
>If you have less than 4 billion rows in these tables int32 keys will be better then going to int64.
>
>>I'm considering doing a major conversion in data structures on an app I am porting from VFP/DBF to .NET/SQL. The .NET framework I use (Strataframe) loves int keys. UIDs just involve a little more tweaking. The app I am converted currently uses pseudo-guids
>>( guid(16) ala the old Rick Strahl algorithm) for every primary and foreign key - and there are a *lot* of them. VFP/VFE loves them. My current VFP-DBF -> SQL conversion routines convert these guid(16)s to guid(36) and then to UID
>>
>>current keys look like this :
>>
>>8298499C6C924F97
>>3EBF95B8F4FE4681
>>591BB961D6194082
>>
>>
>>I am math impaired, but I believe the guid(16) is a valid Hex number. (actually, at one point I had DTS reading them as binary(16) and they converted to UIDs but in some revision of OLEDBVFP that stopped working )
>>
>>Ideally I would need an algorithm that would convert that to an int16 (is that what identity fields are in sql?) If it could be reduced to something smaller, just to give me more wiggle room in setting the seed for future numbers, great.
>>
>>It would be a one-time conversion, just need to make sure all the pk-fk relations remain intact.
>>
>>thoughts?


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
Reply
Map
View

Click here to load this message in the networking platform