Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
773 views
in Technique[技术] by (71.8m points)

sql-server - 如何在SQL Server中创建是/否布尔字段?(How do you create a yes/no boolean field in SQL server?)

从访问数据库转换或一般情况下,创建是/否布尔字段的最佳做法是什么?

  ask by leora translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The equivalent is a bit field.

(等价物是一个位域。)

In SQL you use 0 and 1 to set a bit field (just as a yes/no field in Access).

(在SQL中,您使用0和1来设置位字段(就像Access中的是/否字段一样)。)

In Management Studio it displays as a false/true value (at least in recent versions).

(在Management Studio中,它显示为false / true值(至少在最近的版本中)。)

When accessing the database through ASP.NET it will expose the field as a boolean value.

(通过ASP.NET访问数据库时,它会将该字段公开为布尔值。)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...