Hi Shashidhar,Thanks for the reply. I tried it. I changed @rid to varchar in both SP and my report. but still i am getting the same error. if i run the query alone it works fine. but as SP, it is cusing prob.

so can you suggest me something? also, i didnt get your getorder() function.

Sasidhar Pulivarthi (4/15/2010)hi,The @rid is taking the multi values by comma seperated....ex: 12,45,24,3,78 ..So the datatype int only takes single value of int only...it doesnot allow the above value...For that change the @rid datatype to NVACHAR(<length/MAX>) or VARCHAR(<length/MAX>) in Ur SP.

I agree with what Sasidhar says about the need to change the data type to support a comma-delimited list.

But, please, don't use the code he posted for splitting the list. It is not set-based, and will perform very poorly when you hit it with a large record set.

See the following highly-performing, set-based example for how to split a delimited string apart into a table that can then be used to join into a table:

First, make a function that can be used.

CREATE FUNCTION dbo.DelimitedSplit8K/*************************************************************************************************** Purpose: Split a given string at a given delimiter and return a list of the split elements (items).

Returns: iTVF containing the following: ItemNumber = Element position of Item as a BIGINT (not converted to INT to eliminate a CAST) Item = Element value as a VARCHAR(8000)

Notes: 1. Optimized for VARCHAR(8000) or less. 2. Optimized for single character delimiter. 3. Optimized for use with CROSS APPLY. 4. Does not "trim" elements just in case leading or trailing blanks are intended. 5. cteTally concept originally by Iztek Ben Gan and "decimalized" by Lynn Pettis (and others) for a bit of extra speed and finally redacted by Jeff Moden for a different slant on readability and compactness. Extra speed realized (cuts out 9 SELECT/UNION ALL's) with UNPIVOT thanks to Gianluca Sartori. 6. If you don't know how a Tally table can be used to replace loops, please see the following... http://www.sqlservercentral.com/articles/T-SQL/62867/

Thanks Wayne. I am actually running the rep thru query but will soon change it to SP based on your hints.

And abt that WITH(NO LOCK), i am not sure why it is used. i am new here and in each and every query they have written it. can you explain what is it and wht are its merits and de-merits?

And I have one more prob now:

I have a report which calls another report for details.(like i have given the "jump to report" option.Now i am not getting how to match the parameters between the reports.

In my Recruitment report, we will display the total vacancies in a particular co. in the detail report, we will display the requirement title, no. of posts open, exp reqd and so on. Now company id of my master report must match with that of detail. how to do?