I have a following table with the data
--------------------
Name | Status
--------|-----------
AAA | Active
BBB | Active
CCC | Active
I am trying to get the select query work by using local variable but the query is not working and I am not getting any result.
declare
@v1 nvarchar(100)=null,
@v2 nvarchar(100)=null
set @v1='AAA'
set @v2 =' and Name=' + '''' + @v1 + ''''
SELECT *
FROM Employe
WHERE status = 'Active' + @v2