Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
T-SQL to drop ROWGUID designation
Message
De
14/01/2010 14:02:44
 
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Versions des environnements
SQL Server:
SQL Server 2008
Divers
Thread ID:
01444011
Message ID:
01444022
Vues:
183
>>I have a database with UID pks which are also designated as ROWGUID=yes
>>
>>In poking around in SSMS it seems that the only place this shows up is in the Key properties, where ROWGUID for the key can be flipped to NO.
>>
>>But I need to do this programmatically in a script. I can successfully blow away the pk and that seems to blow away the index and the key as well as the column pk designation but my SMO tool is still complaining that after I strip it all clean it cannot create a new index on that column as it is a ROWGUID.
>>
>>I am a little fuzzy about where the ROWGUID designation is stored. If i do a script to on the key or index I don't see anything different from those that are not designated as Rowguid. I understand in creating the table in code how to turn it on ( off by default of course ) but I don't see anyplace to turn it off without manually doing it to the key in SSMS.
>>
>>Thoughts?
>
>AFAIK RowGuid sets the default value for the field to be NewID()

My problem here is not the default value. I have a pk that is a UID. The ROWGUID property of the key is set to YES. I can change it manually to NO but I want to do it in TSQL.

I have found that if I drop the PK entirely so that neither the key or the index or the column flag are showing anymore I still cannot create a new PK on that column with SMO as it still sees it as a rowguid.

I thought blowing away the key would do it, since that was where the rowguid property was found, but it seems there is something else going on. I looked for a table property to reset but saw nothing there either.


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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform