Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I was asked this on an interview, and would like some feedback...

I have a stored procedure that takes in a varchar parameter IsActive that is either a "YES" or "NO" string.

The stored procedure will query a table that has an Active column with a datatype of bit. If the parameter is "YES" then it will return all rows with an Active column bit value of 1, otherwise for "NO" it will return all rows with an Active column bit value of 0.

Is it best to convert the parameter value from YES/NO to 1/0, or convert the table data from 1/0 to YES/NO when querying?

Is the answer the same if the datatypes are reversed (1/0 being passed in, YES/NO stored in the table)?

share|improve this question

I would think that it's better to convert the parameter from "YES"/"NO" to 1/0 to avoid having to store the more space consuming varchars in the database.

I also think that a query that filters on bit types will be more efficient at searching than one that filters on varchars.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.