Hella all,
What I want to do is something like that, I will have an SQL table depending on my parameter,
DECLARE @find varchar(30)
SET @find = 'no'
SELECT * FROM
(
if @find = 'yes'
(
SELECT * FROM myTable
WHERE ID= '5882'
)
ELSE
(
SELECT * FROM myTable
WHERE OLD_ID= '5882'
)
) X
This is just a simple table that I gave as an example, my real sql query is much more bigger and so I don't think I can use dynamic sql within this query. So I need some other way.