Of course it is a choice to just add a gender value and an indicator it is a value to be double checked.
Updating the current column content isn't such a big deal, handling the consequences of your choices is !
IMHO you would be better of leaving the NULL or adding an Unknown value for that column and restrict it all by a constraint !
update yourtable
set gender = 'U' /* U = unknown or just set it to NULL so there is no doubt it is unknown */
where gender is null
or gender not in ( 'M', 'F', 'U' ) ;
/* after fixing the content, avoid future faults */
alter table yourtable
alter column gender char(1) not null default 'U';
/* set gender constraints to avoid future messed up data */
ALTER TABLE dbo.x ADD CONSTRAINT
CK_gender CHECK (gender in ('M', 'F', 'U'))
;
Keep in mind, especially the last two actions may have consequences towards your current applications !
Test it - test IT
Johan
Learn to play, play to learn !
Dont drive faster than your guardian angel can fly ...
but keeping both feet on the ground wont get you anywhere :w00t:
- How to post Performance Problems
- How to post data/code to get the best help[/url]
- How to prevent a sore throat after hours of presenting ppt
press F1 for solution, press shift+F1 for urgent solution 😀
Need a bit of Powershell? How about this
Who am I ? Sometimes this is me but most of the time this is me