dbTalk Databases Forums  

Re: SQL2000 v SQL7 (true/false v 0/1)

comp.databases.ms-sqlserver comp.databases.ms-sqlserver


Discuss Re: SQL2000 v SQL7 (true/false v 0/1) in the comp.databases.ms-sqlserver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Tony Hodgson
 
Posts: n/a

Default Re: SQL2000 v SQL7 (true/false v 0/1) - 07-29-2003 , 10:34 AM






"Damian Rafferty" <damianrafferty (AT) tiscali (DOT) co.uk> wrote

Quote:
I have upgraded to SQL2000 from SQL7. I have a VB app that uses ADO.
Previously on returned recordsets from SQL, bit data types stored in the
database as 1 or 0 returned as 1 or 0. Now with SQL2000 they are stored in
the table as 1 or 0 but return as true or false. This has caused some coding
issues. How do I get SQL to return 1 or 0 instead of the boolean value?
Try casting the bit value to an integer, cast(fieldname as int), in a
view over the top of your table, then use the view in your ADO Calls
instead of the table directly.

Tony.


Reply With Quote
  #2  
Old   
Erland Sommarskog
 
Posts: n/a

Default Re: SQL2000 v SQL7 (true/false v 0/1) - 07-30-2003 , 03:46 PM






Damian Rafferty (damianrafferty (AT) tiscali (DOT) co.uk) writes:
Quote:
I have upgraded to SQL2000 from SQL7. I have a VB app that uses ADO.
Previously on returned recordsets from SQL, bit data types stored in the
database as 1 or 0 returned as 1 or 0. Now with SQL2000 they are stored
in the table as 1 or 0 but return as true or false. This has caused some
coding issues. How do I get SQL to return 1 or 0 instead of the boolean
value?
SQL Server always return 0 or 1. It does not know what true or false is.
There might be a difference in how ADO handles bit columns, though,
but I don't know of any details about this.


--
Erland Sommarskog, SQL Server MVP, sommar (AT) algonet (DOT) se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.