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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between upgrade and migration in sql server?

760


What are the general features of sql server management studio? : sql server management studio

777


What is report snapshot in ssrs?

215


Explain about unique identifier data type in sql server?

679


What is sql server agent and what are the two modes of authentication in sql server?

738






How do I run sql server 2014?

695


Can group by be used without aggregate functions?

676


You want your report to display a hyperlink that will take users to your intranet. How do you configure such a hyperlink?

292


What is normalization and what are the advantages of it?

706


What is Federation and Federation Member?

90


What is join query?

667


What is indexing a document?

725


You want to use bids to deploy a report to a different server than the one you chose in the report wizard. How can you change the server url?

134


How many levels of sp nesting is possible?

795


What is server-level principal?

114