question

aRookieBIdev avatar image
aRookieBIdev asked

Wild card search in execute sql task

Hi All, Is it possible to use like keyword in my execute sql task parameter ? example select value from table where column like '%?%'
ssisparameters
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Rob Farley avatar image
Rob Farley answered
Yes. But do it more like: > `where column like '%' + ? + '%'` Consider the fact that if you were doing this in T-SQL, you'd be doing something like: > `where column like '%' + @StringToSearchFor + '%'`
2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Håkan Winther avatar image Håkan Winther commented ·
+1, just keep in mind that any index on the column cannot be used for seek. The table/index will be scanned when you use the % at the beginning of the string.
0 Likes 0 ·
Håkan Winther avatar image Håkan Winther commented ·
btw @Rob, welcome back! I read your chapter in MVP Deep Dives, interesting reading as always.
0 Likes 0 ·
Sri 1 avatar image
Sri 1 answered
In normal situation it will not give you any kind of return value.
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.