Solved

sql case statement

Posted on 2013-01-09
1
290 Views
Last Modified: 2013-01-09
When the record is found then Found = 'Y' else Found ='N'. How do I do that in the select statement.

SELECT Found='Y'
-- [lien_id]
--      ,[title_app_id]      
  FROM [t21_maryland_dev].[dbo].[title_app_liens] a
  where a.[title_app_id] = 7599
0
Comment
Question by:Meinhoonaa
1 Comment
 
LVL 11

Accepted Solution

by:
Guru Ji earned 500 total points
ID: 38760649
SELECT CASE WHEN COUNT(1) > 0 THEN 'Y' ELSE 'N' END AS RecordFoundMessage
FROM [t21_maryland_dev].[dbo].[title_app_liens] a
  where a.[title_app_id] = 7599
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

838 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question