Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 SQL Server thinks true is a column name

Author  Topic 

sunrise
Starting Member

1 Post

Posted - 2007-05-12 : 04:38:47
Hello SQL Server Experts,

I'm upgrading an application that uses a VBScript/ASP front-end and MS Access Backend. The application has many points expecting fields to be true or false..

E.g. SELECT * FROM MyTable WHERE Active=True

However, since SQL Server requires 0 or 1 for bit fields, this query keeps failing. SQL Server (2005 Express) thinks True is a column name and is not automatically converting "True" to 1.

It would be so difficult to re-write the application to do this at the VB level, is there a way to make SQL server do this conversion automatically ?

Thanks for any assistance available.

Sunny

chiragkhabaria
Master Smack Fu Yak Hacker

1907 Posts

Posted - 2007-05-12 : 04:56:35
[code]
SELECT CONVERT (bit, 'true'), CONVERT(bit, 'false')
[/code]

Read on more on this

http://msdn2.microsoft.com/en-us/library/ms191240.aspx

Chirag

http://chirikworld.blogspot.com/
Go to Top of Page
   

- Advertisement -