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

Tibco Rendezvous (tibrv) C# .Net example

Parse XML to dynamic object in C#