Nice work guys!
yep, I wondered about a case in the where clause. Why not?
Great! I can keep the original SP and make 2 news SPs in that context.
It´s pretty good because the app is a monster and is hard to determine if are others calls to that SP over thousands of SPs, triggers, ASP, DLLs, jobs...
PS: This call is used to validate something in a long and complex chain of rules (from my view point its like one of Tom's trap to catch Jerry).
Nice and direct like the Vladan solution.
That was my first approach. Unfortunelly the real world query uses joins in the where clause and i got a run time error.
Just because u cannot join the same tables "twice" while the same tables are in a outer join. I tested u query and it worked. Maybe its a limitation only for "old fashioned" joins.
Thanks for all u time guys!