This blog show how to use a variable declared seperately and used in select query as a condition
Example:
Declare @empname as varchar(50)
@empname = 'Karthik'
Select Empsal, Empid
From emptable
Where empname = @empname
SQL Server Transact Basic to Expert - Select Query with variables
SQL Server Transact Basic to Expert - Select Query with variables

Join the conversation! Your thoughts help the community grow.