Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Invalid column name 'true'

1,104 views
Skip to first unread message

webdev

unread,
Aug 10, 2004, 12:36:06 PM8/10/04
to
I'm using ODBC to access an SQL Server 7 database in which I have some
fields of Data Type Bit. In my VBScript ASP scripts I'm inserting values
true and false in these fields which results in an error. If I change my
scripts to insert 1 and 0 then all is well. Can anyone help me understand
what's going on here - I thought that troe was simply an intrinsic constant
for 1, so it should't make any difference? I've upsized an Access database
and my project is well advanced so I don't really want to go back and search
through thousands of lines of code changing true to 1 etc.

Thanks in advance
Rae MacLeman

Narayana Vyas Kondreddi

unread,
Aug 10, 2004, 12:45:21 PM8/10/04
to
Access and SQL Server are different in this regard. You have to specify
either 1, 0 or NULL to bit datatypes.
--
Vyas, MVP (SQL Server)
http://vyaskn.tripod.com/


"webdev" <som...@microsofdt.com> wrote in message
news:109215571...@iris.uk.clara.net...

Message has been deleted
Message has been deleted

Mike Labosh

unread,
Aug 10, 2004, 1:03:48 PM8/10/04
to

In all VB-related technologies before .NET, the behavior of booleans is like
this:

True evaluates to -1
False evaluates to 0

If you perform a test on any integer-type number like this:

Dim i As Integer
i = 10
If i Then DoStuff()

...in this context, if i is 0, it evaluates as False, and for any other
value, evaluates to True.

In SQL Server, the BIT data type is always 1 for True and 0 for False. Note
the change in sign. In "VB Classic", i'ts negative, and in SQL Server it's
unsigned.

Any time I have ever interacted with a non-MS Access database from VB, I
*always* pass the numeric value instead of 'True' or 'False'

--
Peace & happy computing,

Mike Labosh, MCSD

"(bb|[^b]{2})" -- William Shakespeare


Van T. Dinh

unread,
Aug 10, 2004, 1:53:58 PM8/10/04
to
When I upsized from Access to SQL Server, the JET Boolean Field becomes SQL
Server BIT (Null not allowed), i.e. only 0 and 1 are possible.

Unfortunately, only JET SQL recognizes True (-1) and T-SQL doesn't have
True. If you use True in your SQL Strings, you will need to replace with 1.

OTOH, you may want to go through all the SQL Strings against the T-SQL
syntax as JET SQL and T-SQL are different.

--
HTH
Van T. Dinh
MVP (Access)


"webdev" <som...@microsofdt.com> wrote in message
news:109215571...@iris.uk.clara.net...

webdev

unread,
Aug 13, 2004, 10:38:33 AM8/13/04
to

"webdev" <som...@microsofdt.com> wrote in message
news:109215571...@iris.uk.clara.net...

Thank you all for your advice - I think I'll avoid Access next time and go
straight to MSSQL!

Rae Macleman


0 new messages