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

What is triggers and stored procedures?

888


What is efficiency data?

904


Why functions are used in sql server?

896


Which are the new data types introduced in sql server 2008?

842


Tell me what is the order in which the sql query is executed?

897


Mention the uses of stored procedures.

927


What is merge join?

1124


In which files does sql server actually store data?

851


what are the new features introduced in sql server 2000? : Sql server database administration

871


Which operator do you use to return all of the rows from one query except rows are returned in a second query?

943


Where do we use trace frag?

968


Can we insert data if clustered index is disabled?

890


What are the advantages of policy management?

942


What is the difference between DATETIME2 and DATETIME?

1018


What are statistics?

952