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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to get a list of columns in a view using the "sp_help" stored procedure?

785


what is a live lock? : Sql server database administration

631


What options are available to audit login activity? : sql server security

829


How many types of database relationship in sql server?

755


Once setting replication, can you have distributor on sql server 2005, publisher of sql server 2008?

749






what are the types of indexes? : Sql server database administration

794


on line cluster can we make if yes tell me the procedure

1739


What does asynchronous call backs means?

767


What is table valued function and scalar valued functions?

708


Explain DBCC?

733


Is null in sql server?

737


What are the new features introduced in SQL Server 2000? What changed between the previous version of SQL Server and the current version?

2032


Explain the disadvantages/limitation of the cursor?

710


Explain sql server service broker?

702


Can I delete event logs?

702