Why is the following syntax generates the error "An expression of non-boolean type specified in a context where a condition is expected, near '@orderwhere'"
use orders
declare @orderwhere varchar(5000)
set @orderwhere = 'order_status.step = 1'
select order_status.order_id
from order_status
where @orderwhere
exec()
it – juergen d