jampabsatish (9/24/2012)
It works like a champThank you very much Chris !!
You're welcome, and thanks for the feedback. Note that both the problem and the solution appear earlier in this thread;
ssurve (9/22/2012)
...Just add where clause in your second SQL statement
where clx.aprvdt<>0
or write case statement in select as
convert(datetime,CONVERT(nvarchar(27),case when clx.aprvdt=0 then NULL else clx.aprvdt end)) as ADate
and try....
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden