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
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 |
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 |
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 |
What is nested transaction?
How to Run a Query on a Remote SQL Server?
How to define and use table alias names in ms sql server?
How do I view a stored procedure in sql server?
what are the Prerequisites for Replication?
Explain syntax for dropping triggers?
in tabase table having a column in it empname field is there which having 5 duplicate values is there i want deleted all the duplicates i want showing only one name only.
How are the unique and primary key constraints different?
What is multi-statement table-value user-defined function?
Explain the third normal form(3nf)?
How can we check the sql server version?
Wht is SQL Injection Attack ?
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)