SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Administration
 Query Problem with Bit column
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

rnelsch
Starting Member

USA
31 Posts

Posted - 10/04/2012 :  16:38:32  Show Profile  Reply with Quote
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

USA
31 Posts

Posted - 10/04/2012 :  17:02:20  Show Profile  Reply with Quote
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

USA
1974 Posts

Posted - 10/04/2012 :  17:03:20  Show Profile  Visit chadmat's Homepage  Reply with Quote
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

USA
1974 Posts

Posted - 10/04/2012 :  17:04:45  Show Profile  Visit chadmat's Homepage  Reply with Quote
ahh, then just use ISNULL(<columnname>, 0) in the select list.

-Chad
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000