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 Administration
 Query Problem with Bit column

Author  Topic 

rnelsch
Starting Member

31 Posts

Posted - 2012-10-04 : 16:38:32
I have a 'bit' (True/False) column on a table in my DB and for some reason when I run the query I get either "True", "False" or "Blank" when techinically blank isn't even allowed. I was wondering if there is some kind of VB Script or query language that I can get the "Blank" to show up as False, or somehow change the values of "True=1" and "False or Blank=0"

Again this is weird because techinically the column shouldn't be allowing null values so I'm not sure how I'm getting blanks but I am. I did confirm each blank is truly a false.


I know the number of records and the joins I am using are correct but for some reason I cannot get all the report to show the True/False values in each record. EVERYTHING else shows up just fine.

BTW I cannot write to the database I can only query the DB.

Any thoughts or suggestions???

Ryan A Nelsch

rnelsch
Starting Member

31 Posts

Posted - 2012-10-04 : 17:02:20
Update - The reason they show as blank is because the records are from seperate tables. The joins are correct to show all the data but sometimes there are records that don't use the table with the BIT column so it just shows a blank value. Which just means the value on the report should be False. Not sure if this helps?

Ryan A Nelsch
Go to Top of Page

chadmat
The Chadinator

1974 Posts

Posted - 2012-10-04 : 17:03:20
If you run the query in SSMS does it return blank?

If not, then the problem is in your application.


-Chad
Go to Top of Page

chadmat
The Chadinator

1974 Posts

Posted - 2012-10-04 : 17:04:45
ahh, then just use ISNULL(<columnname>, 0) in the select list.

-Chad
Go to Top of Page
   

- Advertisement -