design - Why can't I use a bit field as a boolean expression in a SQL case statement? -


i want select conditionally based on whether bit field true or false. syntax tried:

case when issoon 'soon' else 'not soon' end howsoon 

this makes sense me since follows "when" has boolean expression, issoon is, it's bit field. however, didn't work. had in end was:

case when issoon = 1 'soon' else 'not soon' end howsoon 

this seems redundant me... it's writing if(issoon == true) in programming language instead of more intuitive if(issoon) , goes against grain. why sql set this? because bit fields aren't boolean?

because bit datatype is not boolean type, it's datatype used optimize bit storage.

the fact string "true" , "false" can converted bit can misleading, however, quoting msdn , bit "an integer data type can take value of 1, 0, or null."


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -