Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
mruprai
Starting Member
12 Posts |
Posted - 2012-04-03 : 04:19:48
|
Hii have a field, say 'Name' and another field which is a Bit - isNameMissing.i want to update isNameMissing to 1 if 'Name' is blankso something likeupdate tableset isNameMissing = isNullOrBlank(Name)any advice on syntax? i am new to sql.Kind regards |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2012-04-03 : 04:41:32
|
update tableset isNameMissing = 1where isnull(Name,'') = '' No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
mruprai
Starting Member
12 Posts |
Posted - 2012-04-03 : 05:43:13
|
HiThe trouble with that is it wouldnt set isNameMissing BACK to 0 if the data is changed, without another reset BIT to zero update |
 |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2012-04-03 : 06:28:51
|
That wasn't a point in your first post I would say you don't need that BIT.Just ask the column if it is empty or not (see my where clause above for example). No, you're never too old to Yak'n'Roll if you're too young to die.edit: typo |
 |
|
|
|
|