You are here: Re: Syntax, please :-(((((((((((((( « MsSQL Server « IT news, forums, messages
Re: Syntax, please :-((((((((((((((

Posted by Gert-Jan Strik on 02/15/07 22:12

It's quite simple... once you've seen it!

SELECT CASE WHEN ManagerReport.PIN IS NULL THEN 'TRUE'
ELSE 'FALSE' END AS IsRerun
FROM ...

HTH,
Gert-Jan


Radu wrote:
>
> Hi. I'm trying to build a query which would return TRUE or FALSE as
> 'IsRerun' depending on the matching status with another table, as
> follows (simplified query):
>
> SELECT ImportedPINS.PIN,
> CASE ManagerReport.PIN
> WHEN (IS NULL)
> THEN 'FALSE'
> ELSE
> 'TRUE'
> END AS IsRerun,
> FROM
> ImportedPINS LEFT OUTER JOIN ManagerReport
> ON ImportedPINS.PIN = ManagerReport.PIN
>
> This version returns "Incorrect syntax near the keyword 'IS'"
>
> I have tried a lot of versions..... like
> CASE ManagerReport.PIN
> WHEN ManagerReport.PIN IS NULL
> THEN 'TRUE'
> ELSE
> 'FALSE'
> END AS IsRerun
>
> or
>
> CASE ManagerReport.PIN
> WHEN IS NULL
> THEN 'TRUE'
> ELSE
> 'FALSE'
> END AS IsRerun
>
> or
>
> CASE ManagerReport.PIN
> WHEN NULL
> THEN 'TRUE'
> ELSE
> 'FALSE'
> END AS IsRerun
>
> (this one executes, but ALL show as TRUE, and my data says that out of
> 200 test records I should have 195 Reruns and 5 Not Reruns)
>
> Please, how should I write this ?
> Thanks a lot
> Alex.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация