January 14, 2008 at 8:42 am
I am connecting an oracle database table which is broken down into partitions and I am trying to use an expression to dynamically get these partitions, however I get the following error message:-
TITLE: Expression Builder
------------------------------
Expression cannot be evaluated.
------------------------------
ADDITIONAL INFORMATION:
Attempt to parse the expression ""SELECT * FROM schema.table
PARTITION(name_rest01" + right((DT_WSTR,20)month(dateadd("mm",-1,getdate())),2) +
right((DT_WSTR,50)year(dateadd("mm",-1,getdate())),2))" failed. The expression might contain an invalid token, an incomplete token, or an invalid element. It might not be well-formed, or might be missing part of a required element such as a parenthesis.
Here is the query:-
"SELECT * FROM schema.table
PARTITION(name_rest01" + right((DT_WSTR,20)month(dateadd("mm",-1,getdate())),2) +
right((DT_WSTR,50)year(dateadd("mm",-1,getdate())),2))
your aid would be highly appreciated
January 14, 2008 at 10:32 am
"SELECT * FROM schema.table
PARTITION(name_rest01" + right((DT_WSTR,20)month(dateadd("mm",-1,getdate())),2) +
right((DT_WSTR,50)Year(dateadd("mm",-1,getdate())),2)
Should work for your expression. I think the only thing wrong with your expression is that it has an extra parenthesis at the end.
I hope this helps
January 14, 2008 at 11:18 pm
Thanks for the quick response!
There is a problem with the result since it will evaluate to
SELECT * FROM schema_name.table_name
PARTITION name_rest011207
Now this query is meant to work with an oracle database and this syntax is not correct. The correct syntax to work with oracle partitions is:-
select * from schema_name.table_name partition(partition_name)
I can't make do with the parenthesis!
January 14, 2008 at 11:22 pm
DONE IT!
here is the syntax:-
"SELECT * FROM schema_name.table_name
PARTITION (name_rest01" + right((DT_WSTR,20)month(dateadd("mm",-1,getdate())),2) +
right((DT_WSTR,50)Year(dateadd("mm",-1,getdate())),2) +")"
and here is the result:-
SELECT * FROM schema_name.table_name
PARTITION ( name_rest011207)
January 15, 2008 at 10:27 am
Good job - glad you figured it out.
P.S. I don't envy you having to work with Oracle
January 16, 2008 at 6:57 am
Thanks!
Oracle is stable and thats it, apart from that its not worth the hype!!!!
BTW - I think that Microsoft have hit the jack pot with there strategy of making their tools available to all and work with any given source/destination. Basically expressions make it possible to write SQL for any given implementation which is an amazing capability.
Cheers!
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply