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 cross join in sql server joins?
Determine when an index is appropriate?
You notice that the transaction log on one of your databases is over 4gb the size of the data file is 2mb what could cause this situation, and how can you fix it?
statement (of account) Receive ID_receive Date_receive Amount_receive TO_receive From_receive Description_receive 1 2010/01/01 500 Bank Ahmed Payment from the account 2 2010/02/01 700 Bank Ahmed Payment from the account Payment ID_payment Date_payment Amount_payment From_payment To_payment Description_payment 1 2010/03/01 1000 Ahmed Sales Sale goods 2 2010/04/01 1500 Ahmed Sales Sale goods How can crate Stored Procedures for the statement (of account) from these tables? I want statement (of account) like this: (in sql 2005) ID_ name description debit account credit account balance
What is use of except clause?
How do we return a record set from a Stored Procedure in SQl server 2000?
How to transfer an existing table from one schema to another schema in ms sql server?
How to find the last update record in SQL Server?
What are the advantages of user-defined functions over stored procedures in sql server?
What are the joins in sql server? : sql server database administration
What is single-user mode?
What is normalization and its forms?
4 Answers Challenger Financial,