Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Binding Checkbox to nchar column
Message
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Versions des environnements
Environment:
C# 2.0
Divers
Thread ID:
01445996
Message ID:
01446021
Vues:
29
>>Then, before they put handcuffs on me for violating the forum etiquette <g>, quick question. In order to change the column in SQL Server from char to bit and not to lose the existing values, I would have to create a temp column to hold the values, right?
>
>Yep,
>Something like this (NOT TESTED!!!!)
>
>ALTER TABLE TableName ADD TempColumn bit NULL
>GO
>UPDATE TableName SET TempColumn = CASE WHEN TheCharColumn = 'A'
>                                            THEN 1
>                                       WHEN TheCharColumn = 'I'
>                                            THEN 0
>                                  ELSE NULL END
>GO
>ALTER TABLE TableName DROP COLUMN TheCharColumn
>GO
>EXEC sp_rename @objname = 'TableName.TempColumn',  @newname = 'TheCharColumn', @objtype = 'COLUMN'
>GO
>
>AGAIN!!!
>NOT TESTED!
>Just have a pretty good backup first!

Thank you very much, Borislav.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform