reporting services - Report Builder 3.0 underlying SQL -
i have report builder 3.0 report has several parameters on it. specifically, account number (defined char(12) in database). database vendor supplied database, have 0 control on database schema.
my question when have free form parameter account id, how transformed query sent sql database?
the way handle these free form fields have user defined function:
public function convertstringtoarray(sourcestring string) string() dim arrayofstrings() string dim emptystring string = " " if string.isnullorempty(sourcestring) arrayofstrings = emptystring.split(",") else arrayofstrings = sourcestring.replace(" ", "").split(",") end if return arrayofstrings end function
and parameter defined as: @acctlist = code.convertstringtoarray(parameters!acctlist.value)
the sql query has in clause: ac.account_id in (@acctlist)
my question how build in clause. literally like: ac.account_id in (n'acct1',n'acct2').
i'm thinking is, , reason think it's important query when running in ssms run in less 1 second if clause has ac.account_id in ('tgif').. take 13+ seconds if have ac.account_id in (n'tgif'). total dataset returned 917 rows.
the database querying 2008 r2 sp2, compatibility set sql 2008.
you assumption correct predicate of 'where thing in (@parameter)' being 'where thing in ('value1', 'value2', etc). provided @parameter allows multiple values. can tie parameter query using code. can have dataset other main dataset simple 'select value values' values table of values needed parameter choice. more efficient unless have string split.
Comments
Post a Comment