SQL 更新数据库中的sql位域
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6879999/
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
Update sql bit field in database
提问by user282807
In a sql table I have a bit field and the value is displayed as True, when I update in code Update table1 set Active='True'
it makes the update but the value is now displayed as 1
instead of True
. How do I make it put the value 'True'
instead of the integer in the table? Thanks.
在 sql 表中,我有一个位字段,该值显示为 True,当我在代码中更新时, Update table1 set Active='True'
它会进行更新,但该值现在显示为1
而不是True
. 我如何让它把值'True'
而不是整数放在表中?谢谢。
回答by Martin Smith
Bits
in SQL Server are always stored as 1
or 0
in a bitmap.
Bits
在 SQL Server 中始终存储为位图1
或0
位图。
The "Edit Table" option in SSMS just translates this to True
or False
for presentation purposes, this is nothing to do with how it is actually stored.
SSMS 中的“编辑表”选项只是将其转换为True
或False
用于演示目的,这与它的实际存储方式无关。