Bits in SQL Server | Database Journal

Bits in SQL Server

Jul 14, 2004
2 minute read

The
objective of this article is to analyze and understand how SQL Server uses
Binary digits for categorizing and how to query such categorized binary numbers
to produce detailed results.

What is Bit?

Bit is the
short form for binary digit.

What is Binary?

Binary is
a base 2 numbering system. A binary notation consists of two characters: 0 and 1.

This is
the way to count up to 128 in binary

Decimal-Binary Conversion
DecimalBinaryPlace Value
1120
21021
410022
8100023
161000024
3210000025
64100000026
1281000000027

Usage of Bit positions in SQL Server

SQL Server
uses binary digit positions to categorize different choices in many places,
especially in system tables and some global variables.

For example,
when you execute the query "Select @@Options" SQL Server outputs a number
that has a definite meaning. The table below shows how SQL Server categorizes
user options using binary digit positions. Multiple bits can be on at the same
time.

ValueConfigurationDescription
1DISABLE_DEF_CNST_CHKControls
interim or deferred constraint checking.
2IMPLICIT_TRANSACTIONSControls
whether a transaction is started implicitly when a statement is executed.
4CURSOR_CLOSE_ON_COMMITControls
behavior of cursors after a commit operation has been performed.
8ANSI_WARNINGSControls
truncation and NULL in aggregate warnings.
16ANSI_PADDINGControls
padding of fixed-length variables.
32ANSI_NULLSControls
NULL handling when using equality operators.
64ARITHABORTTerminates
a query when an overflow or divide-by-zero error occurs during query
execution.
128ARITHIGNOREReturns
NULL when an overflow or divide-by-zero error occurs during a query.
256QUOTED_IDENTIFIERDifferentiates
between single and double quotation marks when evaluating an expression.
512NOCOUNTTurns
off the message returned at the end of each statement that states how many
rows were affected.
1024ANSI_NULL_DFLT_ONAlters
the session’s behavior to use ANSI compatibility for nullability. New columns
defined without explicit nullability are defined to allow nulls.
2048ANSI_NULL_DFLT_OFFAlters
the session’s behavior not to use ANSI compatibility for nullability. New
columns defined without explicit nullability are defined not to allow nulls.
4096CONCAT_NULL_YIELDS_NULLReturns
NULL when concatenating a NULL value with a string.
8192NUMERIC_ROUNDABORTGenerates
an error when a loss of precision occurs in an expression.
16384XACT_ABORTRolls
back a transaction if a Transact- SQL statement raises a run-time error.
Advertisement

If you get
a result that says 5496, then it means it is the combination of
4096+1024+256+64+32.

Database Journal Logo

DatabaseJournal.com publishes relevant, up-to-date and pragmatic articles on the use of database hardware and management tools and serves as a forum for professional knowledge about proprietary, open source and cloud-based databases--foundational technology for all IT systems. We publish insightful articles about new products, best practices and trends; readers help each other out on various database questions and problems. Database management systems (DBMS) and database security processes are also key areas of focus at DatabaseJournal.com.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.