0

How do I create a bit constant in T-SQL? I tried using Convert(bit, 0) but that is having a weird effect in SSDT.

jdphenix
  • 15,022
  • 3
  • 41
  • 74
Jonathan Allen
  • 68,373
  • 70
  • 259
  • 447

2 Answers2

1

Have you tried: CAST(0 AS BIT)
Also have a look here:
Imply bit with constant 1 or 0 in SQL Server

Community
  • 1
  • 1
Jan
  • 11
  • 1
0

I'm not sure what you mean by a weird effect in SSDT, but here's two more options you can try:

Using CAST instead of convert:

CAST(0 AS BIT)

Declaring the variables first:

DECLARE
   @True BIT,
   @False BIT;
SET @True = 1;
SET @False = 0;
Robby Cornelissen
  • 91,784
  • 22
  • 134
  • 156