In one of the tables, i've a varchar column by name expression which has values like min(id),max(id) where id is the other column. I'm getting the value for the expression column. Then i want to execute it.
DECLARE @exp varchar(20)
SELECT @var1=expression from table1 where id=1 //var1 now holds min(id)
Now i want to return min(id) by using the varibale name.
I tried SELECT @var1 FROM table1...but it doesn't work.