Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Boolean DataType

Status
Not open for further replies.

simran1

Programmer
Apr 23, 2002
82
US
Hi,
I had to import my table design form MS Access to SQL Server. But Data Type "Yes/No" was imported as bit type.
How do i store a boolean type data in SQL server.
I already have my VB application developed, using MS Access as database. Now i want to move to SQL server, without making any changes to the code in VB. In VB code i have used true/false values to read boolean data types from the Access tables.
What are the ways to store a boolean daa type in SQL server?
 
I use INT as the datatype when I upsize a table from Access. Access (and I assume VB) will still correctly evaluate the values as TRUE/FALSE. BIT doesn't allow a sign, and TRUE (from Access) is stored as -1.
 
Bit should work in VB. Bit is either 1 or 0. True = Anything not 0 (e.g. 1). False = 0.

Anyways, the strictest interpretation of Boolean is 1 or 0, which is what Bit is. Purity demands using Bit to represent Booleans.
 
Hi,

I tried using Bit as the data type, but doing a sql query like
SQL = "Select * from trying Where text3 = " False
gives an error.
So how do i write my query to read if the value was true/false.
Or if i have to use INT type, will i be able to do a query of the type mentioned above.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top