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
Is it important for a database administrator to understand the operating system and file access?
Tell me extended events in sql server 2008?
What is clustered vs nonclustered index?
How can you transfer data from a text file to a database table? Or how can you export data from a table to a comma delimited (csv) file? Or how can you import data from ms access to a table in a database? Or how can you export data from a table to an excel file?
What is deploy, process and build? : sql server analysis services, ssas
How to create a store procedure with encryption?
What is the preferred way to create a clustered and non-clustered index? Which index should you create first the clustered or non-clustered?
What are drilldown reports?
Why does sql studio use a single registered database repository? : sql server management studio
How to assign null values to variables or columns?
Tell me what are the essential components of sql server service broker?
Write a SQL query to make a column as unique?
How to receive returning result from a query?
Where the sql logs gets stored?
Can You Use Data Mining Models In Ssrs?