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 |
ismailc
Constraint Violating Yak Guru
290 Posts |
Posted - 2008-11-13 : 07:59:51
|
Hi, I'm struggling with adding a parameter in the like operatorSQL: select * from table where test like '%filter%'SSRS: like '%@filter%' I have tried: like '"*" & @filter & "*"'Please Assist!Regards |
|
ismailc
Constraint Violating Yak Guru
290 Posts |
Posted - 2008-11-13 : 08:47:45
|
Senior Collegue assisted & got me going:like '%' + @filter + '%' |
|
|
tendai
Starting Member
2 Posts |
Posted - 2011-08-17 : 09:32:40
|
i am trying to get the like operator to work using what was suggested but i dont seem to get it to work my query is as belowselect a.warehouse as wse,d.description as warehouse,b.card_number as card_no,a.product as product,long_description as description,expected_quantity as expected_qty,adjustment_quantit as variance,expected_quantity+adjustment_quantit as actual_qty,current_cost as cost,adjustment_quantit*current_cost as value from scheme.stockm a,scheme.sttakehm b,scheme.sttakedm c,scheme.stkwhm dwhere a.product=c.product_codeand a.warehouse=b.warehouseand b.card_number=c.card_numberand adjustment_quantit<>0and b.card_number like '%' + @card_number + '%' and d.warehouse in ('37','38')and d.warehouse=a.warehouseorder by warehouse asc |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-08-18 : 04:30:05
|
what are you passing as values for @card_number?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
tendai
Starting Member
2 Posts |
Posted - 2011-08-19 : 10:01:36
|
quote: Originally posted by visakh16 what are you passing as values for @card_number?i am passing 22 as the card_number------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/
|
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-08-19 : 12:08:43
|
assuming @card_number is int you should make statement likeand b.card_number like '%' + cast(@card_number as varchar(10)) + '%'------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
|
|
|
|
|