|
Помогите с запросом при выборе multi-value parametr
|
|||
---|---|---|---|
#18+
Делаю отчета в RS 2008 Есть запрос SELECT ID1, SRS, ID2 FROM [111X] WHERE (ID1 = @ID1) Что мне нужно написать, что бы использовать multi-value parametr Заранее огромное спасибо и извините за примитивизм вопроса... ... |
|||
:
Нравится:
Не нравится:
|
|||
27.11.2012, 15:08 |
|
Помогите с запросом при выборе multi-value parametr
|
|||
---|---|---|---|
#18+
Код: sql 1. 2. 3.
... |
|||
:
Нравится:
Не нравится:
|
|||
27.11.2012, 16:26 |
|
Помогите с запросом при выборе multi-value parametr
|
|||
---|---|---|---|
#18+
Чайник в синтаксисе, По мотивам интернета. Я использую 2-й способI used the MS example of checking the multi checkbox for the parameter and then using a WHERE Column IN (@MultiParam) Есть 2 пути: Filter метод (не очень быстрый) и SQL метод (эффективнее) Filter Method (не очень быстрый) Create a multi-value parameter. Let's call it @Animals and you select Dog, Cat, Bird (or Select All) Your main Dataset, which will return a result set to your report, does not reference @Animals in it's where clause. Instead, click on Dataset Properties and select Filters In the Filter setup dialog, click on the column in your result set that corresponds to the Animal value. For the operator, select the "In" operator For the value, type in [@Animals] Done! This will "post-filter" your SQL query and only return the values that have been filtered by your multi-value parameter. Only Dog, Cat, Bird records will return to your report. The downside to this approach is that the processing occurs at the Report Server level and not by your Database server, because you are not using SQL to do the work. In many cases (most cases!) I find this the easiest and quickest way to do what you want. SQL Method (эффективнее) Create a multi-value parameter. Let's call it @Animals and you select Dog, Cat, Bird (or Select All). Same as the Filter Method! You will need a stored procedure for your main report Result Dataset. Let's call it sp_get_animals. sp_get_animals will take one argument, @Animals, so the calling mechanism looks like this: exec sp_get_animals @Animals When you are configuring your parameters in the Query dialog, use the following expression to define the value of your parameter: =join(Parameters!Animals.Value,",") This will create a string that looks like this: "Bird,Dog,Cat" In the body of your stored procedure, you will have to parse @Animals to pick off Bird, Dog, Cat. Once you have parsed @Animals, you can use the SQL IN clause to actually process it. Т.е. по русски: Тогда с помощью Expression вы можете сформировать строку со всеми выбраннымии Value параметра и передать ее в хранимку. =Join(Parameters!<ParameterName>.Value,", ") - Выражение, объединяющее в одну строку все значения в массиве многозначного параметра типа String. А в хранимке выполняйте парсинг и обрабатывайте дальше, как вам нужно. ... |
|||
:
Нравится:
Не нравится:
|
|||
27.11.2012, 18:14 |
|
Помогите с запросом при выборе multi-value parametr
|
|||
---|---|---|---|
#18+
Спасибо Огромное А можно передать не в запрос а в фильтр??? И если можно, то что для этого нужно сделать ... |
|||
:
Нравится:
Не нравится:
|
|||
28.11.2012, 12:47 |
|
|
start [/forum/topic.php?fid=31&msg=38055366&tid=1534190]: |
0ms |
get settings: |
11ms |
get forum list: |
11ms |
check forum access: |
4ms |
check topic access: |
4ms |
track hit: |
27ms |
get topic data: |
9ms |
get forum data: |
2ms |
get page messages: |
51ms |
get tp. blocked users: |
2ms |
others: | 259ms |
total: | 380ms |
0 / 0 |