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# Crop white space from around the image