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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Report Parameters

Author  Topic 

midpenntech
Posting Yak Master

137 Posts

Posted - 2009-03-16 : 13:19:38
I know this is an easy easy thing to figure out but for the life of me I can not. ON the data tab i have a field that is using the @custnum function so it will prompt me what cust # i want to search for. Well under the report Parameter it lets you choose multi the only problem is i dont know how to choose more than one. when i go to the preview. and it gives you that drop down i put in the cust # like this

12324,
12345,
24134,

that did not work. I then tried
'12334','12324','23413'

That didnt work

it works for one but not multi. Little help would be greatful thanks.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-03-16 : 13:43:35
you should give them in a line like 12324,12345,24134,...
also your where condition in query should be like

WHERE ',' + @custnum +',' LIKE '%,' + CAST(CustNum AS Varchar(10)) + ',%'

where CustNum is your table field
Go to Top of Page

midpenntech
Posting Yak Master

137 Posts

Posted - 2009-03-16 : 14:11:07
got an error message with your code Converting carchar value ',' to data type int. Here is my exact code

SELECT eqdailyinv.kequipnum, eqdailyinv.kmfg, eqdailyinv.kmodel, eqdailyinv.eqpsldcust, eqdailyinv.eqpslddate, eqdailyinv.eqpphybr, eqdailyinv.custins,
custmast.custname, repmast.custname AS repname, GPCOSTBYINV.cost, CASE WHEN sell <> 0 THEN (sell - COALESCE (cost, 0)) END AS Grosspro,
GPCOSTBY61000.sell, custmast.custstate, eqdailyinv.eqpsldinv
FROM GPCOSTBY61000 INNER JOIN
GPCOSTBYINV ON GPCOSTBY61000.kequipnum = GPCOSTBYINV.kequipnum RIGHT OUTER JOIN
eqdailyinv ON GPCOSTBYINV.kequipnum = eqdailyinv.kequipnum LEFT OUTER JOIN
custmast ON eqdailyinv.eqpsldcust = custmast.kcustnum LEFT OUTER JOIN
repmast ON eqdailyinv.custins = repmast.custslsmn
WHERE (eqdailyinv.eqpslddate BETWEEN @fromdate AND @thrudate) AND (custmast.custsnum = '000') AND (eqdailyinv.eqpsldamt <> 0) AND
(',' + @eqpsldcust +',' LIKE '%,' + CAST(eqpsldcust AS Varchar(10)) + ',%')
ORDER BY eqdailyinv.kequipnum
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-03-16 : 14:13:56
eqpsldcust & @eqpsldcust both should be of type varchar
Go to Top of Page

midpenntech
Posting Yak Master

137 Posts

Posted - 2009-03-16 : 14:24:54
I do not understand some of the cust #s also have letters? would that be why its not working as well
Go to Top of Page
   

- Advertisement -