>Naomi,
>
>Actually there is more to that query. It is a part of a stored procedure called from an ASP.NET application. Based on the parameter passed I am dynamically building the actual query.
>
>I could not come up with a way of doing this without using Execute.
>
>Thanks again for your help,
>DAniel
Check
How to return a value from dynamically executed T-SQL code FAQ #8130 just for your general education.
If it's not broken, fix it until it is.
My Blog