[mssql] Boolean 데이터 타입 (BIT)
Boolean형식을 mssql에서 사용하고 싶으면 BIT
데이터 형식을 사용하면 된다.
Reference
- 스택 오버플로우 : Is there a Boolean data type in Microsoft SQL Server like there is in MySQL?
- 스택 오버플로우 : How do I select a 1 as a bit in a sql-server view?
Concept
DECLARE @b1 BIT = 'false'
PRINT @b1 --prints 0
DECLARE @b2 BIT = 'true'
PRINT @b2 --prints 1
- boolean형식으로 select하고 싶을때
SELECT id, name, CONVERT(BIT, 1) AS active
FROM users
Comments