AnsweredAssumed Answered

How to use variables inside a select (SQL Server)?

Question asked by egonsa on Apr 17, 2018
Latest reply on Apr 17, 2018 by heheimann

Is it possibile to use variables inside a select?

For example I've tried this manual query in a datareader


DECLARE @anno as int
set @anno = 2018

select * from table where myyear=@anno


When I've tried to show the result, I received the error from the Boardserver:

Must declare the scalar variable "@anno".


It would be very helpful if we could use also variables, especially in complex sql-statements.