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 .

Answers were Sorted based on User's Feedback



i have account table which consists of account name,card no and card no consists 16 digits now i wa..

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

i have account table which consists of account name,card no and card no consists 16 digits now i wa..

Answer / rahul

hi every one.

select name,
case
when card_no like'4%' then 'visa'
when card_no like'5%' then 'master'
end result from account;

Is This Answer Correct ?    4 Yes 1 No

i have account table which consists of account name,card no and card no consists 16 digits now i wa..

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

More SQL Server Interview Questions

What is inner join in sql server joins?

0 Answers  


What is cursors? And what are the different types of cursor?

0 Answers  


Explain primary key, foreign key and unique key?

0 Answers  


How to bind a view to the schema of the underlying tables?

0 Answers  


Do you know exporting and importing utility?

0 Answers  


What is entity data services?

0 Answers  


What is transaction server distributed transaction?

0 Answers  


Explain what is lock escalation and what is its purpose?

0 Answers  


What is the difference between the application object and session object?

0 Answers  


What do you mean by a dependent functionality in a build?

0 Answers   HCL,


What is difference between index and primary key?

0 Answers  


How get current date in SQL server 2000

4 Answers   Cap Gemini, Polaris,


Categories