Hi,
I have an MSDE 2000 SP3a running on Win2k3, problem I have is that I am
writing a little basic web app. One of the fields I have set to bit
which I assumed I would use for True or False (1 or 0) - Using
Dreamweaver it seems that when I check a field in order to set it to
"true" it seems to have a value of -1 in the table? Why is this? Can
anyone shed some light for me
cheers
Baronne
On 11 Mar 2005 07:56:29 -0800, Baronne wrote:
>I have an MSDE 2000 SP3a running on Win2k3, problem I have is that I am
>writing a little basic web app. One of the fields I have set to bit
>which I assumed I would use for True or False (1 or 0) - Using
>Dreamweaver it seems that when I check a field in order to set it to
>"true" it seems to have a value of -1 in the table? Why is this? Can
>anyone shed some light for me
Hi Baronne,
The BIT datatype is not boolean. It is numeric, with only the values 0
and 1 allowed. Some people use BIT to represent booleans, but you'll
have to convert true to 1 (or 0) and false to 0 (or 1), and back again,
when going to and from the database.
Since SQL Server has no boolean datatype, you can pick wahtever you
want. I usually use a CHAR(1) datatype, with a CHECK constraint to make
sure that only 'T' or 'F' are allowd (or 'Y' / 'N' - depending on the
specific case).
Best, Hugo
(Remove _NO_ and _SPAM_ to get my e-mail address)
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment