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 .

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is compound operators?

544


Explain relational data?

542


Explain different backup plans?

528


What does the on update no action do?

587


What is raid? : SQL Server Architecture

589






What are the difference between “where” and “having” clause in sql server?

581


What is triggers and its types?

540


What is the command used to recompile the stored procedure at run time?

614


What is save transaction and save point?

622


What is an identity?

567


What are the three different part of rdl file explain them?

170


What the difference between UNION and UNIONALL?

568


Do you know spatial data types - geometry and geography in sql server 2008?

576


What are the differences between user defined functions and stored procedures?

529


What are different types of roles provided by ssrs?

112