Trying to use a variable in the LIKE clause of a SELECT statement.
Hope this is simple, but available guidance hasn't worked.
As seen below, query works when a "fixed" value is used with wildcard characters, but I haven't managed to get it with the variable...
--The Workdays column, in c_Persons table, is NCHAR(7)
--This works
--SELECT * FROM c_Persons WHERE Workdays LIKE '%3%'
DECLARE @DOW NCHAR(7)
SET @DOW = '%3%'
--This returns nothing.
--SELECT * FROM c_Persons WHERE Workdays LIKE @DOW
SET @DOW = '3'
--This returns nothing.
--SELECT * FROM c_Persons WHERE Workdays LIKE '%@DOW%'
--This returns nothing.
SELECT * FROM c_Persons WHERE Workdays LIKE '%' + @DOW + '%'