adspace


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 the difference between for xml raw and for xml auto?

1117


How can I check that whether automatic statistic update is enabled or not?

1111


What is a coalesce function?

1282


what is the Ticketing tool used in Wipro technologies at Bangalore...???

8230


Why use identity in sql server?

1199


What is in place upgrade in sql server?

1125


How can you append an identity column to a temporary table?

1070


Explain “row_number()” in sql server with an example?

1079


Does view occupy space?

1019


How to provide default values to function parameters?

1258


What are the different SQL Server Versions you have worked on?

1079


How to remove duplicate rows from table except one?

1088


What are the kinds of subquery?

1106


Why and when do stored procedure recompile?

1060


How to rebuild the master database?

1165