Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
Can I use IF EXISTS inside CASE block in SQL (MS SQL SERVER 2000)? if yes, how??? if you have example, it will help. Thanks Mayur |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
IF EXISTS, is what exists?
SQL queries the database, so if you want only certain items, you use a WHERE clause. -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) wrote in message ... Hi Can I use IF EXISTS inside CASE block in SQL (MS SQL SERVER 2000)? if yes, how??? if you have example, it will help. Thanks Mayur |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Mayur,
Since EXISTS returns a boolean result you can potentially use it in the searched form of the T-SQL CASE function. The example shown below, from one of my databases, returns a report name and a string indicating whether or not a benchmark exists for that report in another table. SELECT r.ReportUniqueName, CASE WHEN EXISTS (SELECT ReportID FROM ReportBenchmarks WHERE ReportID = r.ReportID) THEN 'Has Benchmark' ELSE 'No Benchmark' END FROM Reports AS r I wouldn't say this is the most efficient way to write the query, but it does work. -- Rob Bovey, Excel MVP Application Professionals http://www.appspro.com/ * Take your Excel development skills to the next level. * Professional Excel Development http://www.appspro.com/Books/Books.htm wrote in message ... Hi Can I use IF EXISTS inside CASE block in SQL (MS SQL SERVER 2000)? if yes, how??? if you have example, it will help. Thanks Mayur |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Block cell if specific condition exists | Excel Discussion (Misc queries) | |||
change data of entire column from small case to upper case | Excel Worksheet Functions | |||
Changing multiple cell text from lower case to upper case | Excel Discussion (Misc queries) | |||
End Select without Select Case, Block If without End If errors | Excel Programming | |||
Change the text from lower case to upper case in an Excel work boo | Excel Discussion (Misc queries) |