stored procedure for bit conversion
Posted on 2009-04-16
I need some help creating a stored procedure that will do a bit conversion for three checkboxes that I have on a form. Currently the form submits information as "yes" or "no" and is causing an error when it hits the database which is using a binary value for those responses. I would like to call a stored procedure that does this process for me. I think I'm close, but am unsure how to get it to enter it into multiple columns.
Here is what I have so far:
create procedure convertbits (@checkbox nvarchar(10) )
declare @checkconvert bit
if (@checkbox = 'Yes') set @checkconvert = 1 else set @checkconvert = 0
insert into usertable(checkboxcolumn1) values (@checkconvert)
How do I properly have it do this for checkboxcolumn2 and checkboxcolumn3 within the same stored procedure?