i have account table which consists of account name,card no
and card no consists 16 digits now i want to retrieve the
data if card no starts from 4 then it should print visa and
if it starts from 5 then it should print master so plse help
me to write simple query with out store procs .
Answers were Sorted based on User's Feedback
Answer / rajesh bhawsar
select name,
(case left(cardno,1)
when '4' then 'visa'
when '5' then 'master'
end) as result from account
Is This Answer Correct ? | 5 Yes | 1 No |
Answer / rahul
hi every one.
select name,
case
when card_no like'4%' then 'visa'
when card_no like'5%' then 'master'
end result from account;
Is This Answer Correct ? | 4 Yes | 1 No |
Answer / kiranu
Hi every one
select name, cardno(case substring(cardno,1,1)when '4' then
'Visa' when '5' then 'Master' end) as Result from account;
Is This Answer Correct ? | 1 Yes | 0 No |
What are the joins in sql server? : sql server database administration
Why we need to use secondry database file? though, we can do same work using primary database file also.
What are the advantages of log shipping?
Can we join two tables without primary key?
What is the return type of executeupdate ()?
How would we use distinct statement? What is its use?
What is ms sql server service broker?
What happens if an integer is too big for int date type?
What command is used to rename the database?
Explain the microsoft sql server delete command?
What is shrink log file?
How to set database to be single_user in ms sql server?