BIT data type - something wired - explained inside the message

Hi.
I have 2 SQL servers
SQL Server 2005 Express (english) for development
SQL Server Enterprise (spanish) for production

I have a combobox for a BIT field
The combobox rowsource is false;"No";true;"Si"
The combobox shows "No" and "Si" (no & yes in spanish) and stores False or True respectivily in the associated db field.

This works fine in the development server, but not in the production one.
It's like if there is a language problem.
I tried to store 0 and 1 in the field but neither the dev or prod server allows it.

How can i solve it?

sorry for my poor english
 
Personally I never use bit fields. I use TinyInt. But make sure your dev sql server version is the same as prod version, same service pack, etc. There have been changes to handling of bit data types between versions.

My advice is stay away from Bit, and change your db to use TinyInt instead. Then change your code from using true/false to using 1/0. Just my 2c. :)

[edit] sql sometimes has problems with linked tables which use bit fields that have NULL values. If you decide to use a bit field, always give it a default value of either true or false. Don't let it become null. TinyInt doesn't have this problem (and allows values from 0 to 255 if you ever need extra values).
 
Extra values? :)

Rarely Just TRUE or FALSE - The Daily WTF :D

As for your problem, I'm not entirely sure what's going on as I've never had problems with BIT fields whatsoever, nullable or not. What language are you using, how are you connecting to SQL Server and how are you executing the insert/update statements?

SQL Server expects 1 or 0 at the query level. When you specify a parameter to a stored procedure in Visual Studio you need to use True/False however, which can be somewhat confusing. If it's refusing your using of 0 or 1, it's probably because of ADO.NET or something.

I don't use a Spanish SQL Server at work, but I don't see how that should matter. Maybe if you could post the relevant code snippet it will shed some light on this..
 
Back
Top