>I see Sergey and Chad have given you working code. FWIW I suspect the ISNULL() was messing you up. Wouldn't that be NVL() instead? If nothing else, ISNULL() returns a logical value.
>
I made the same mistake few threads ago. Tracy is working with SQL Server, where IsNULL is NVL equavalent.
If it's not broken, fix it until it is.
My Blog