It would be preety good idea to use Dynamic SQL in this case using CASE statement instead. -Abhijit, MCP
check this blog....www.sqlity.blogspot.com -Abhijit, MCP
Before sugestion any idea Can you tell us in SELECT clause which columns you are considering (Table1 / Table2 / Table3 / Table4). -Abhijit, MCP
Its always a best practices to write your Business logic in stored proc, so if any changes occur (in future) logic the only thing is you have to...
Can you summarized the output result set so we will get an idea what output you require?
Separate names with a comma.