Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
simflex
Constraint Violating Yak Guru
327 Posts |
Posted - 2013-07-31 : 12:17:54
|
Can someone please help with inserting values into a bit data type?We have a checkbox on one of our forms.If a user checks this box and clicks the Save button, we would like to have a value of 1 or True inserted into the table.If however, the box is not checked, rather than inserting NULL, we would like to insert 0 or False.Any idea how to solve this?Thanks alot in advance |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2013-07-31 : 12:37:08
|
1 and 0 will evaluate as bit set and bit not set (true and false). Microsoft SQL Server MVP, MCT, MCSE, MCSA, MCP, MCITP, MCTS, MCDBA |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-08-01 : 02:58:07
|
quote: Originally posted by simflex Can someone please help with inserting values into a bit data type?We have a checkbox on one of our forms.If a user checks this box and clicks the Save button, we would like to have a value of 1 or True inserted into the table.If however, the box is not checked, rather than inserting NULL, we would like to insert 0 or False.Any idea how to solve this?Thanks alot in advance
Check the status of checbox (checkbox checked/not checked) in your front end application code and pass value as 1 or 0 to the database.------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
|
|
|
|
|