question

Kev Riley avatar image
Kev Riley asked

bit datatype vs boolean in SSMS

Can anyone explain why when viewing a table that has a bit datatype field, through Query Designer in SSMS, you cannot edit the values to be '1' or '0'

You get the error message:

String was not recognised as a valid Boolean
Type a value appropriate for the data type

Funny that, I'm not trying to store a boolean, I'm trying to store a bit, i.e. "An integer data type that can take a value of 1, 0, or NULL." [BOL]

Ok - so MS have decided to expose this in the Query Designer as a boolean - that I can handle - but then not allowing '1','0' or 'T','F' seems crazy!


Note : I don't actually recommend the use of Query Designer for modifying data!

ssmsdatatypesquery-designer
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Matt Whitfield avatar image
Matt Whitfield answered

It's because the native .NET Boolean type is extremely fussy in what it interprets as True / False. That was something I paid particular attention to in my editor.

But that fussiness is a pain elsewhere too - for example, if you're editing an XML file that XmlSerializer will be reading, then even if you get the capitalisation wrong, then it won't recognise it as a Boolean.

Welcome to the world of tomorrow!

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.