Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

Is it important for a database administrator to understand the operating system and file access?

1005


Tell me extended events in sql server 2008?

1001


What is clustered vs nonclustered index?

950


How can you transfer data from a text file to a database table? Or how can you export data from a table to a comma delimited (csv) file? Or how can you import data from ms access to a table in a database? Or how can you export data from a table to an excel file?

1032


What is deploy, process and build? : sql server analysis services, ssas

1115


How to create a store procedure with encryption?

1011


What is the preferred way to create a clustered and non-clustered index? Which index should you create first the clustered or non-clustered?

916


What are drilldown reports?

158


Why does sql studio use a single registered database repository? : sql server management studio

1007


How to assign null values to variables or columns?

982


Tell me what are the essential components of sql server service broker?

945


Write a SQL query to make a column as unique?

1045


How to receive returning result from a query?

1130


Where the sql logs gets stored?

992


Can You Use Data Mining Models In Ssrs?

146