Thanks for the replies, but these queries are going to be in a controlled environment. I can make sure they look a certain way syntax-wise. Just can't get rid of functions like coalesce() or datepart.
in reply to Pull info from select clause.
I installed the SQL::Statement module and tried it out, however, it's choking on the sql syntax. I hate to say it but this is a Sql Server 6.0 db I am working with. The query I am using for my testing works fine when run on the sql server, however, SQL::Statement does not like it and it choking with this error:
SQL ERROR: Bad set function before FROM clause.
It looks like this module expects a certain syntax, but I can't break my query just to make it work with the module. I'll work with the module some more, but so far not seeming to like my query syntax.