August 23, 2005 at 4:34 pm
I have input parameter store procedure. Depending on the parameter passed in, my query have to change the field on it. My query is:
If @offer = 'USA'
Begin
select top 5* from mytable1 where status = 'A'
Else
Select top 5 * from mytable1 where status_country = 'A'
End
Can this be done in one query instead of 2 queries like above. How can I instruct my query to change the field name depending on the parametter?
This will be a great help for me.
Thank so much.
Minh Vu
August 24, 2005 at 7:13 am
There's just no need for dynamic sql here ::
The Curse and Blessings of Dynamic SQL
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply