SQL Like statement with variable

DECLARE @myVariable as char(2)
SELECT @myVariable=column1
FROM Table2 
WHERE id = 1
SELECT * FROM Table1
WHERE column1 like '%'+@myVariable+'%'

Comments

Popular posts from this blog

Parse XML to dynamic object in C#

C# Updating GUI from different thread