Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8115599
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T03:31:26+00:00 2026-06-06T03:31:26+00:00

I know that SQL Server does not have boolean data type and your best

  • 0

I know that SQL Server does not have boolean data type and your best option is to use BIT data type.

My question is to what boolean expressions evaluate. For example if I have the statement

expr1 AND expr2

and if expr1 is true and expr2 is false, do they internally evaluate to BITs with values 1 and 0? And then the AND operator checks for BITs?

I think this is not the case because then the following should work:

select 1 where 1 and 0

So does sql server internally have a boolean data type?

The following work

select 1 where 1 = 0
select 1 where 1 = 0 and 0 = 0

but this

select 1 where 1 and 0

reports

Msg 4145, Level 15, State 1, Line 1
An expression of non-boolean type specified in a context where a condition is expected, near ‘and’.

which means that internally sql server handles the expressions as booleans, but why don’t have access to that data type.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T03:31:27+00:00Added an answer on June 6, 2026 at 3:31 am

    SQL Server does have a Boolean data type. You can open the Logical Operators (Transact-SQL) manual page and find the following statement:

    Logical operators test for the truth of some condition. Logical operators, like comparison operators, return a Boolean data type with a value of TRUE, FALSE, or UNKNOWN.

    It’s just that you can’t use this type in the same way you can use other Transact-SQL data types. For instance, you can’t declare boolean variables or arguments, add boolean columns to tables, cast to/from a boolean. But you can have boolean expressions and use them in contexts where they are required (WHERE, ON, check constraints…). You can also apply boolean operators to those expressions: AND, NOT et al. (Operators like <, =, LIKE and other can also be considered boolean, in the sense that they return boolean results, but their operands are actually never booleans.)

    So, to summarise, there is a boolean type in SQL Server but its use is limited, as described above. Why? My answer may be a silly one, sorry, but that’s one that I’m satisfied with: this is the way they chose it to be.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does Microsoft Access have Full Text Search? I know that MySQL and SQL Server
I know that SQL server use memory cache for the all operations by loading
I have an application using LINQ-to-SQL with SQL Server CE 4. I know that
I am using SQL Server for my web application. How will I know that
I know I can combine tables with sql queries, but that's not what I
With sql Server 2005. I have declared a trigger that get fired AFTER INSERT,
First let me say I'm fully aware sql server does not short circuit evaluate.
I have an SQL server database that I am querying and I only want
I know that in SQL Server, the maximum number of objects in a database
I know that a SQL dump is a series of insert SQL statements which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.