Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

help with expression builder in SSIS 2008 Expand / Collapse
Author
Message
Posted Wednesday, October 23, 2013 6:44 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Today @ 2:28 AM
Points: 22, Visits: 113
Hello there,,

i got a variable which is an Expression.

my expression is this:

'||'''DateVar'''||'

i got another variable which is the DateVar and looks like :

02/07/2013

i want to populate the expression and to get this expression:
'||''02/07/2013'''||'

when im trying to do that like this:
'||''@[user::DateVar]'''||'

i dont get what i need....(i doesnt treat the variable as a variable but as a text)

i think i should use an escape character...

can someone help plz?

thank you



Post #1507588
Posted Wednesday, October 23, 2013 6:55 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 10:46 AM
Points: 13,622, Visits: 10,513
avishain (10/23/2013)
Hello there,,

i got a variable which is an Expression.

my expression is this:

'||'''DateVar'''||'

i got another variable which is the DateVar and looks like :

02/07/2013

i want to populate the expression and to get this expression:
'||''02/07/2013'''||'

when im trying to do that like this:
'||''@[user::DateVar]'''||'



Dont't use the single quotes.

"||" + @[user::DateVar] + "||".

I assume @[user::DateVar] has the string data type. If not, you need to add a cast.




How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?

Member of LinkedIn. My blog at LessThanDot.

MCSA SQL Server 2012 - MCSE Business Intelligence
Post #1507595
Posted Wednesday, October 23, 2013 7:07 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Today @ 2:28 AM
Points: 22, Visits: 113
thank you very much,

but i have to keep this format since i execute this string via EXCECUTE SQL TASK ( i send it to an oracel DB to run a "PACKAGE" (stored procedure)


so i have to keep this format in order to run it in the oracle...

Post #1507605
Posted Wednesday, October 23, 2013 7:09 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 10:46 AM
Points: 13,622, Visits: 10,513
avishain (10/23/2013)
thank you very much,

but i have to keep this format since i execute this string via EXCECUTE SQL TASK ( i send it to an oracel DB to run a "PACKAGE" (stored procedure)


so i have to keep this format in order to run it in the oracle...



If you want some decent help, you'll need to give more information.
How does the entire query need to look like?




How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?

Member of LinkedIn. My blog at LessThanDot.

MCSA SQL Server 2012 - MCSE Business Intelligence
Post #1507606
Posted Wednesday, October 23, 2013 7:19 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Today @ 2:28 AM
Points: 22, Visits: 113
the first pic is the query that runs inside the oracle .

the second is how it should be in the ssis


i need to replace all the dates in that query to variables...

cause i want it to be dynamic


  Post Attachments 
1.jpg (5 views, 42.50 KB)
2.jpg (5 views, 84.74 KB)
Post #1507612
Posted Wednesday, October 23, 2013 12:51 PM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 10:46 AM
Points: 13,622, Visits: 10,513
Just make sure that each part of the query that is not dynamic is a string properly enclosed with double quotes.
The variables need to be concatenated to the strings using +. Make sure those variables are either strings or casted to strings.




How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?

Member of LinkedIn. My blog at LessThanDot.

MCSA SQL Server 2012 - MCSE Business Intelligence
Post #1507797
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse