How to build a like query dynamically for execute SQL activity

activities
sql

#1

I have tried this
“Select WELLIDA, WELLNAME
FROM dbo.wvwellheader Where wellname LIKE '%” & @WellName & “%’”

and this

“Select WELLIDA, WELLNAME
FROM dbo.wvwellheader Where wellname LIKE '%” + @WellName + “%’”

but i get error “String constants must end with a double quote”


#2

hi @shanugoel
Use this

Select WELLIDA, WELLNAME
FROM dbo.wvwellheader Where wellname LIKE ‘%’ and @WellName like ‘%’"

Thanks
Ashwin S


#3

Thanks. This works great.