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 are Sql Reporting Services and analysis services? Can u Explain
What is partitioned view?
Suppose i have a table that contains 5 columns like col1,col2...colm5.I want to import only two column through BCP utility.How to do same through BCP in sybase.
How you can change the database name in SQL SERVER?
How to select true false based on column value in sql server?
How will u find the query which is running in some other machine
4 Answers CarrizalSoft Technologies, IBM,
How many types of subqueries are there in sql server?
what is the purpose of creating view is sql server 2000
What is the difference between for auto and for nested?
What are some examples of schemas?
What are cursors and when they are useful?
What are the types of normalization?