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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is log cache in sql server?

713


Where are full-text indexes stored?

729


We need to perform what steps in the following order to work with a cursor?

911


What is a scheduled job or what is a scheduled task?

709


How to change parameter value inside the report?

131






Explain different types of index?

769


What is the openxml statement in sql server?

729


What are the five major components of a dbms?

668


You want to implement the one-to-many relationship while designing tables. How would you do it?

709


How to add a new column to an existing table with "alter table ... Add" in ms sql server?

755


What is the importance of a recovery model?

772


What is mapping schema?

768


Explain about system stored procedure?

772


What are the steps to process a single select statement?

686


How secure is sql server database?

690