Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
jplace
Starting Member
1 Post |
Posted - 2012-11-18 : 18:33:07
|
I am trying to accomplish something like...SELECT ItemID, ItemNumber, ItemDesc FROM ITEMS WHERE ItemDesc LIKE '%variable%'The problem is I am using a parameterized query, so it is structure like...rsItems_cmd.CommandText = "SELECT ItemID, ItemNumber, ItemDesc FROM ITEMS WHERE ItemDesc LIKE ?"and then passing the parameter...rsItems_cmd.Parameters.Append rsItems_cmd.CreateParameter("param1", 200, 1, 50, rsItems__Variable(Where rsItems__Variable is a string of the value passed)How do I use a LIKE command when passing a text string as a parameter?? |
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2012-11-18 : 18:40:31
|
Try WHERE ItemDesc LIKE '%'+rsItems_Variable + '%'This won't work if your paramater looks like 'A,B,C' (A delimited list).If that's the case, look at parsing the string and then joining to it using the function ParseValues, which can be found on this site.JimEveryday I learn something that somebody else already knew |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
|
|
|
|
|
|