什么是 PostgreSQL 和 SQL Server 中“位”数据类型的默认“长度/值”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24132853/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What is default "length/values" of "bit" data type in PostgreSQL and SQL Server
提问by Meem
Questions:
问题:
1. What is the default length/values of bit data type in PostgreSQL?
1. PostgreSQL 中位数据类型的默认长度/值是多少?
2. What is the default length/values of bit data type in SQL Server?
2. SQL Server 中位数据类型的默认长度/值是多少?
3. What is the by default column values(NULL/NOT NULL) in PostgreSQL?
3. PostgreSQL 中的默认列值(NULL/NOT NULL)是什么?
4. What is the by default column values(NULL/NOT NULL) in SQL Server?
4. SQL Server 中的默认列值(NULL/NOT NULL)是什么?
回答by Ajay2707
An integer data type that can take a value of 1, 0, or NULL.(refer below msdn link)
整数数据类型,其值可以为 1、0 或 NULL。(请参阅下面的 msdn 链接)
Bit means 1 bit, its value either 0 or 1, while select or insert condition, we use True for 1 and False for 0.
Bit 表示 1 位,其值为 0 或 1,在选择或插入条件时,我们使用 True 表示 1,False 表示 0。
Its length is 1 and values will be eigher True(1) or False(0).
它的长度为 1,值将是 True(1) 或 False(0)。
For sqlserver
对于 sqlserver
http://msdn.microsoft.com/en-IN/library/ms177603.aspx
http://msdn.microsoft.com/en-IN/library/ms177603.aspx
For postgresSql
对于 postgresSql
how does postgres handle the bit data type?
http://www.postgresql.org/docs/current/static/datatype-binary.html
http://www.postgresql.org/docs/current/static/datatype-binary.html