Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VFP GUID(16) to SQL UID
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Import/Export
Divers
Thread ID:
01230551
Message ID:
01230661
Vues:
24
>>So, the question : Has anyone done this ( Rick ? ) or does anyone know of a CAST() that would get the GUID(16) into UID in one go ( and perhaps give me some hints about how to incorporate that knowledge into an SSIS package )
>
>If you specify the data source as a query, use the following for all PK/FK fields:
>
>cast(LEFT([GUID-16 field],8)+'-'+substring([GUID-16 field],9,4)+'-'+
>substring([GUID-16 field],13,4)+'87D9-9DE36423D459' as uniqueidentifier) as [field_name]
>
>Basically, adding the dashes and tacking on the missing 18 characters on the end. Then it casts properly. Since you're using the same string to pad it out, all PKs and FKs will still match.

Thanks, that is definitely one of the areas I was looking at ( of course I was looking for an approach that was less work ( surprise surprise ) and wouldn't require writing a query that specifically cast every guid field but rather somehow magically saw that guid(16) as a binary 16 and hence a UID . ) Agree that for SSIS your approach is AFAIK the only way to pull it off.


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.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform