422,026 Members | 1,154 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 422,026 IT Pros & Developers. It's quick & easy.

SQL Query?

P: 93
I have a SQL table with a field that has a length of 1. The field is named Status and has a value of I (inactive) or A (active). Status varchar(1). I want to show either Inactive or Active instead of just an I or A. Is this possible?
Jan 3 '18 #1

✓ answered by GazMathias

Sure,

Take a look at the Case expression.

Expand|Select|Wrap|Line Numbers
  1. SELECT CASE [Status] WHEN 'I' THEN 'Inactive' ELSE 'Active' END AS [Status] FROM [Your table name]
  2.  

Gaz

Share this Question
Share on Google+
2 Replies


GazMathias
Expert 100+
P: 189
Sure,

Take a look at the Case expression.

Expand|Select|Wrap|Line Numbers
  1. SELECT CASE [Status] WHEN 'I' THEN 'Inactive' ELSE 'Active' END AS [Status] FROM [Your table name]
  2.  

Gaz
Jan 3 '18 #2

P: 93
Thank you very much.
Jan 4 '18 #3

Post your reply

Sign in to post your reply or Sign up for a free account.