?
Solved

sql case statement

Posted on 2013-01-09
1
Medium Priority
?
293 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 11

Accepted Solution

by:
Guru Ji earned 2000 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Audit has been really one of the more interesting, most useful, yet difficult to maintain topics in the history of SQL Server. In earlier versions of SQL people had very few options for auditing in SQL Server. It typically meant using SQL Trace …
If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

764 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