Tuesday, March 27, 2012

can we do string manipulation on a parameter?

I populated a parameter list with dataset.
The parameter @.type_year has items look like
"plan_2000" or "Actual_2000".
Now my question is, if we can use some string function targeting @.type_year in the query.
something like "select ..... from ... where
year=getyear(@.type_year) and type=gettype(@.type_year)" ?
Please let me know if you know the feasibility. Thanks.
Sincerelyyou can. regarding your SQL database its easier to do.
for example in SQL Serbver, you can create 2 functions to extract the year
part or the type part of your parameter. (using the SQL substring function)
but I recommand to use 2 parameters
* 1 for the year
* 1 for the type
"Frank RS" <FrankRS@.discussions.microsoft.com> a écrit dans le message de
news:2B0E0EA7-2955-4B9A-BEFA-053ECA609CB9@.microsoft.com...
> I populated a parameter list with dataset.
> The parameter @.type_year has items look like
> "plan_2000" or "Actual_2000".
> Now my question is, if we can use some string function targeting
@.type_year in the query.
> something like "select ..... from ... where
> year=getyear(@.type_year) and type=gettype(@.type_year)" ?
> Please let me know if you know the feasibility. Thanks.
>
> Sincerely

No comments:

Post a Comment