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 a system database and what is a user database?

1086


What is the dbcc command and why is it used?

1052


Please illustrate physical database architecture? : SQL Server Architecture

987


You have to store user responses of ‘yes’ and ‘no’ what kind of data type is best suited for this task?

946


Define left outer join in sql server joins?

961


What will happen if a column containing char type data is changed to the nchar data type?

1103


Do you know how to send email from database?

1005


How to write a query with a right outer join in ms sql server?

913


hi, the following are the outputs of sp_spaceused and sp_tempdbspace sp_spaceused ------------ database size unallocated size tempdb 77752.95 MB 28026.99 MB sp_tempdbspace ------------- database size spaceused tempdb 77752.945312 1.007812 the unused space in sp_spaceused is nearly 28 Gb and in sp_tempdbspace is nearly 76 Gb cany any one explain about this output and why its giving different results.

2929


what do you understand by change data capture?

1021


explain what is a schema in sql server 2005? Explain how to create a new schema in a database? : Sql server database administration

937


How to connect to a sql server using odbc_connect()?

1154


What are the types of subquery?

1042


What happens if you insert a duplicate key for the primary key column in ms sql server?

976


What is index fragmentation in ms sql server?

1083