[dba-VB] Wha's up with True?

Gustav Brock Gustav at cactus.dk
Sat Mar 27 17:19:18 CDT 2010


Hi John

That is in Access, right? As I've understood it, 1 and 0 _are_ true and false in SQL Server and preferred to "True" and "False". In Access, true is - as you know - numerically displayed as -1. 
I've made it a habit when working with numeric values for True and False to use Abs([MyBooleanOrBitField] to avoid further thinking about this and to make SQL code easier to move between SQL Server and Access.

/gustav

>>> jwcolby at colbyconsulting.com 27-03-2010 23:06 >>>
Any idea why it displays as -1?

John W. Colby
www.ColbyConsulting.com 


Gustav Brock wrote:
> Hi John
> 
> It is 1 that is True.
> 
> /gustav
> 
>>>> jwcolby at colbyconsulting.com 27-03-2010 22:39 >>>
> I am working on my billing database which holds the data in SQL Server.  I have a bit field and 
> while it shows a value of -1, if I try to do a == -1 it filters out records.  If I try == True it 
> pukes.  I have to do a <> 0 which returns records where that bit is set (true).
> 
> So bit fields are not True / False?  What "value" is it?  And why does it display -1 but I can't 
> test for that?
> 
> TIA






More information about the dba-VB mailing list