How to use a variable multiple times in the data flow

DECLARE
@StartTime datetime,
@EndTime datetime
SET @StartTime = (SELECT MAX(AvailDateTime) FROM dbo.Fact)
SET @EndTime = (SELECT MAX(AvailDateTime) FROM dbo.Product);
--DATEADD(day, 1, @StartTime);
--PRINT @StartTime
--PRINT @EndTime;
WITH
dates AS (
SELECT DATEADD(Minute,5,@StartTime) AS [date]
WHERE DATEADD(Minute,5,@StartTime) <= @EndTime
UNION ALL
SELECT DATEADD(minute, 5 ,t.date) AS [date]
FROM dates t
WHERE DATEADD(minute, 5, t.date) <= @EndTime
I have the above sql, in this I'm using the 2 variables and calling @Starttime Variable couple of time. How should I build the SSIS package based on this query? how can I call the same variable in different place? how will SSIS take it?
Thanks

Since you have the variables set in code you just can place this code into the SQL code section of say an OLEDB source
like there
or

Similar Messages

  • How to play one clip multiple times at the same time?

    I am writing a little game where a certain sound has to be played quite frequently. I load it as a Clip and play it with
    myClip.setFramePosition(0);
    myClip.loop(0);If the sound has to be played again but is still being played by another event, the setFramePosition() method resets the sound and the first playing instance is cut off.
    A workaround would be that each object that needs to play this sound would get its own copy, but that is not feasible due to heavy memory consumption.
    So here it goes: How can I play a single sound multiple times at the same time? Is that possible?
    Edited by: andrasz on Feb 27, 2009 12:37 AM

    If the sound has to be played again but is still being played by another event, the setFramePosition() method resets the sound and the first playing instance is cut off.
    A workaround would be that each object that needs to play this sound would get its own copy, but that is not feasible due to heavy memory consumption.
    So here it goes: How can I play a single sound multiple times at the same time? Is that possible?Ummmm, if you're using a clip, you'll have to maintain one copy per object that needs to play the sound concurrently. You could keep one master copy, and then create copies of the clip as necessary to play them, and then just dump the copies to decrease memory consumption.
    A second idea would be to write your own Clip class. Esentially, all you would need to do is dump some sound data onto a TargetDataline to play it. It'll handle the buffering and playing at the correct speed itself. If that's all you did, you should be able to dump multiple times from the same instance and play it multiple times.
    Obviously, that's just a theory. In practice, it may not work that way...

  • How to use substitution variables in sqlplus activity of process flow

    I have a process flow that does nothing more than create a couple of packages that I cannot successfully deploy from OWB. A workaround, not something that I want to do, but currently there is not much time to adjust the packages so they can be deployed from OWB.
    I can successfully create the packages from files that are present in a directory on the server. But the location (directory) is not the same in all cases (OTAP). So I thought to use an input parameter to the process flow (named TELLINGEN) and use that in the sqlplus activity.
    I have created the parameter START_PATH with a default value.
    I have added an sqlplus activity and placed the following into the PARAMETER_LIST variable of the activity:
    ?${Target.ConnectString}?@${TELLINGEN.START_PATH}/npl_dbug.pkg?
    When I run the process flow I see the following in the output:
    SQL*Plus: Release 10.2.0.3.0 - Production on Tue Mar 18 18:10:14 2008
    Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
    With the Partitioning, OLAP and Data Mining options
    SP2-0310: unable to open file "${TELLINGEN.START_PATH}/npl_dbug.pkg"
    SQL> SQL> Disconnected from Oracle Database 10g Enterprise Edition Release
    10.2.0.3.0 - 64bit Production
    With the Partitioning, OLAP and Data Mining options
    It obviously connects to sqlplus but then cannot find the file. Presumably because the variable has not been substituted.
    How can I persuade the activity to substitute the variable?
    Kind regards,
    Eric.

    Have been reading around a bit and found the (a) solution:
    I placed the following in PARAMETERLIST:
    ?${Target.ConnectString}?@${Working.RootPath}/base64.sql?
    And it turns out ${Working.RootPath} is pointing to the location you can provide under the configure for the sqlplus activity in the process flow. Just as you have to provide the target destination as indicated here: Re: SQLPLUS Activity in Process Flow
    From the documentation it was not immediately clear to me where Working.RootPath was pointing to.

  • How to access system variables in Script Component in data flow task in SSIS

    Hi,
    I am new to SSIS. Can someone tell me how to access system variable in Script Component in SSIS using C# code.
    Thanks

    You can use the System.Environment.GetEnvironmentVariable(...) to read the variables. An example is here:
    http://msdn.microsoft.com/en-us/library/y6k3c7b0.aspx
    Vikash Kumar Singh || www.singhvikash.in

  • How to use case and decode to extract the data

    Hello PL/SQL Gurus,
    I am using Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production version
    I have a table in following format -
    drop table TT2;
    create table TT2(College, Class,gender,status,fees) as select
    'IITB','MBA','M','P',255600 from dual union all select
    'IITK','MTech','M','P',300000 from dual union all select
    'IITD','MBA','F','P',450000 from dual union all select
    'IITKH','MBA','F','P',350000 from dual union all select
    'IITC','MTech','F','P',420000 from dual union all select
    'IITB','MTech','M','P',185000 from dual union all select
    'IITC','MTech','M','P',235000 from dual union all select
    'IITD','MBA','F','F',175000 from dual union all select
    'IITM','MBA','M','F',257000 from dual union all select     
    'IITKH','MTech','F','P',335000 from dual union all select
    'IITD','MBA','F','P',540335 from dual union all select
    'IITC','MBA','F','F',125089 from dual union all select
    'IITD','MTech','M','P',290756 from dual union all select
    'IITM','MBA','M','P',200000 from dual union all select     
    'IITKH','MBA','F','F',534990 from dual union all select
    'IITD','MBA','F','P',221000 from dual ;some of the extraction conditions are as following -
    CASE CONDITION
    College in 'IITB' and status='P'- 'WestRegion Passed'
    College in 'IITC' and status='P'- 'SouthRegion Passed'
    College in 'IITD' and 'IITK' and status='P' and Gender='F' - 'NothRegion Female Passed'
    College not in 'IITK' and status='F' - 'Ex Kanpur Failed'
    Expected output -
    Region Statnding     Fees
    WestRegion Passed     440460
    SouthRegion Passed     655000
    NothRegion Female Passed     1386335
    Ex Kanpur Failed     1092079SQL Used
    I am using the following query which only make sure of case but this is not how i want the output , if i try to use the case within decode then how to work on this -
    SELECT (CASE WHEN College in ('IITB') and status='P' then sum(fees) else 0 end) WP,
    (case when College in ('IITC') and status='P' then sum(fees) else 0 end) SP,
    (case when College in ('IITD','IITK') and gender='F' and status='P' then sum(fees) else 0 end) NFP,
    (case when College in ('IITK') and status='F' then sum(fees) else 0 end) ExKF
    FROM
    TT2
    GROUP BY College, Class,gender,status

    user555994 wrote:
    Thank you so much jeneesh i am really thankful to you ...vov.
    one more query in case if any of the selection don't have the output data , then values will be displayed like -One way..
    with t as
    --"Add all your descriptions
    (select 'WestRegion Passed' region_standing from dual union all
    select 'SouthRegion Passed' region_standing from dual union all
    select 'NothRegion Female Passed' region_standing from dual union all
    select 'Ex Kanpur Failed' region_standing from dual)
    select region_standing,sum(fees) fees
            from (
            (SELECT CASE WHEN College in ('IITB') and status='P'
                                then 'WestRegion Passed'
                        when College in ('IITC') and status='P'
                                then 'SouthRegion Passed'  
                        when College in ('IITD','IITK') and gender='F' and status='P'
                                then 'NothRegion Female Passed'
                        when College in ('IITK') and status='F'
                                then 'Ex Kanpur Failed'
                        else 'Others' end region_standing,
                        sum(fees) fees
            FROM TT2
            GROUP BY  CASE WHEN College in ('IITB') and status='P'
                                then 'WestRegion Passed'
                        when College in ('IITC') and status='P'
                                then 'SouthRegion Passed'  
                        when College in ('IITD','IITK') and gender='F' and status='P'
                                then 'NothRegion Female Passed'
                        when College in ('IITK') and status='F'
                                then 'Ex Kanpur Failed'
                        else 'Others' end
            union all
            select region_standing,0
            from t
    group by   region_standing;
    REGION_STANDING              FEES
    Others                     2567835
    NothRegion Female Passed   1211335
    WestRegion Passed           440600
    Ex Kanpur Failed                 0
    SouthRegion Passed          655000
    {code}
    Edited by: jeneesh on Nov 5, 2012 5:07 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How to use a km service to show the data of collaboration rooms.

    I follow the method in documents:
    import com.sapportals.portal.prt.runtime.PortalRuntime;
    IRooms roomsAPI = (IRooms) PortalRuntime.getRuntimeResources().getService(IRooms.PORTAL_SERVICE_ID);
    and cast Exception come out,  means can not transfer to IRooms
    And I alse wonder why PortalRuntime.getRuntimeResources().getService(IRooms.PORTAL_SERVICE_ID)'s return type is IService, but IRooms is not extends from IService ,how can casting succesussful......

    I follow the method in documents:
    import com.sapportals.portal.prt.runtime.PortalRuntime;
    IRooms roomsAPI = (IRooms) PortalRuntime.getRuntimeResources().getService(IRooms.PORTAL_SERVICE_ID);
    and cast Exception come out,  means can not transfer to IRooms
    And I alse wonder why PortalRuntime.getRuntimeResources().getService(IRooms.PORTAL_SERVICE_ID)'s return type is IService, but IRooms is not extends from IService ,how can casting succesussful......

  • Calling a vi multiple times makes the timer "crash"

    I use a subvi for writing data from a profibusnetwork. In this vi I can set a timer for the "update" to write away the data. I use a global variable to remember the last time the writing was done. The problem I encounter here is that when I use this subvi multiple times only the data I want updated fastest will be written away.. My question is: Is it possible to use just this one vi multiple times instead of renaming it for every datasource I want to write away?
    Thx in advance,

    Use a while loop with an uninitialised shift register instead of a global,
    and build it into a function marked "re-entrant". This way different data
    exists in each different copy of it in the code.
    henk007 wrote in message
    news:[email protected]..
    > I use a subvi for writing data from a profibusnetwork. In this vi I
    > can set a timer for the "update" to write away the data. I use a
    > global variable to remember the last time the writing was done. The
    > problem I encounter here is that when I use this subvi multiple times
    > only the data I want updated fastest will be written away.. My
    > question is: Is it possible to use just this one vi multiple times
    > instead of renaming it for every datasource I want to write away?

  • Using same bind variable multiple times in Dynamic sql

    Hi;
    I have a query which uses same variable multiple times, is there a way I could use only one time that variable and it will take multiple times.
    Query is;
    execute immediate 'SELECT count(*) FROM x WHERE MONTH_ID = :VOMNTH_ID
    UNION
    SELECT count(*) FROM Y WHERE MONTH_ID = :VOMNTH_ID
    union
    SELECT count(*) FROM z WHERE MONTH_ID = :VOMNTH_ID ' using month1,month1,month1
    What I want Just supply month1 only once.
    Your help is appreciated.
    VKM

    the way suggested by Nigel worksI'm not sure what you intend to use the resultset for but remember that UNION will remove duplicates from the result set and could possibly sort it too. Even if that were not the case (for example if you used UNION ALL) Oracle does not specifically guarantee the order of resultsets.
    If you are expecting the first row to contain the first count (and so on) then you might not get the answer you are expecting.
    Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
    SQL> SELECT 3 n
      2  FROM   dual
      3  UNION
      4  SELECT 2 n
      5  FROM   dual
      6  UNION
      7  SELECT 1 n
      8  FROM   dual;
             N
             1
             2
             3
    SQL> SELECT 1 n
      2  FROM   dual
      3  UNION
      4  SELECT 2 n
      5  FROM   dual
      6  UNION
      7  SELECT 2 n
      8  FROM   dual;
             N
             1
             2
    SQL>

  • How can I have use the same div ID multiple times on the same page?

    Okay so a problem I encounter a lot is that often times I want to use the same div ID several times on the same page. An example of this is when I'm creating table like designs.
    Let's say for instance I create a div ID called 'product-container'. I want to use 'product-container' multiple times on the same page but if I do this it is improper XHTML and will throw errors in any XHTML validator (you are only allowed to use a div ID once on any XHTML page in order for it to be standards compliant).
    Now the first option is that I could define 'product-container' in my CSS style sheet multiple times by doing something like this...
    #product-container {
         width: 300px;
    #product-container-2 {
         width: 300px;
    #product-container-3 {
         width: 300px;
    #product-container-4 {
         width: 300px;
    What you will see there however is that it seems pointless to define the same ID numerous times over (just adding a number on the end) when each ID is the exact same thing and has the exact same attributes.
    Now what I have noticed is that there are some sites out there who manage to have the same ID appear several times in the code but add a number to it just like above. The difference is that they only have one definition for 'product-cointainer' in their CSS document but in their actual XHTML code they have IDs for 'product-container' but with numbers on the end like 2,3,4,5, etc. It's almost as if JavaScript or some other code is automatically appending a number on the end of the ID so the validator won't consider the markup to be invalid, but yet it knows that it's using the same 'product-container' style that is contained in the CSS style sheet.
    I hope I explained this correctly. I'm just hoping to find a way that I can put the same div ID on a page multiple times without having to define it over and over again in my CSS.
    Any help is much appreciated!

    Because it seems like by using a class you can't make this position as 
    well as you can by using an ID. Am I wrong?
    An ID name can be used only one time per page.  A class name can be used multiple times per page.
    .product {
    width: 300px;
    text-align:left;
    color: #FF0000
    border: 2px solid #666;
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists
    www.alt-web.com/
    www.twitter.com/altweb
    www.alt-web.blogspot.com

  • Using multiple timer in the same SessionBean

    Hello,
    Is it possible to use multiple timer in the same Stateless Session Bean. In my application a user can schedule some task to execute. To do so I was thinking of creating a Session Bean which would create calendar timer on user request and, when one of the timer expires, retrieve the task to execute thanks to the information stored in the timer.
    When I tried the solution explained above, it seems that the @timeout method is synchronized on 1 timer. For example if I create a timer that will be executed every 10 seconds and another one executed every 30 seconds, the timeout callback is called every 30 seconds but 4 times.
    My code looks like that :
    @Stateless
    @LocalBean
    public class TimeManager {
        public void onUserRequest(ScheduleExpression expression) {
            Timer timer = timerService.createCalendarTimer(expression, timerCfg);
        @Timeout
        void timeout(Timer timer) {
            logger.log(Level.INFO, (String) timer.getInfo());
    }Is there a way to do what I want?
    Thank you

    This doesn't make any sense to me. If i were to write a bunch of schemas for a particular applicaion, would
    I have them all in the same namespace? You would normally have one schema that describes the information model associated with the one namespace that the different documents in your application use.
    If so, why can't I load more than one in the same name space?The parser chooses the schema based on the namespace alone. There is no other information used to decide which schema to use, so you can only have one schema for the namespace.
    They all have different root elements.You can have different root elements in the one schema.
    I don't even need the namespaces, but I can't
    figure out how to get rid of them (the schema isn't valid with out them according to XML Spy). You can set the schema explicitily before parsing, but not (AFAIK) set after parsing has begun, except by using the mapping of namespace to schema location.
    I have also tried to use the external-noNameSpaceSchemaLocationproperty, but it doesn't seem like you can pass in an array of schemas to that one. It only expects a
    String as the Object you pass in to setProperty. Yes, you can only validate a document against the one schema.
    So, how can I load all my schemas so I don't have to reference them in the XML documents? Either combine your schemas so you have one schema for your namespace that validates elements which are defined in that namespace (the formal/correct way of doing it), or construct a filter that inserts a PI to point to the schema once the root element is opened (the pragmatic/bit of a hack way of doing it).
    Pete

  • How to use Value Variable in Report Painter Column defined as Formula

    Hi Gurus,
    In report painter, how can I add one field (exchange rate) in selection screen, so that user can provide the exchange rate to be used, then execute the report, the exchange rate will used to multiple local currency amount.
    The reason for this is we want use provided exchange rate to convert the amount from once currency to the other currency.
    Alternatively I am studying the functionality of "Value Variable" and found that I can perform the task from this. I have created the value variable but when I am using the variable in Report Painter columns as "&ZVALVAR", system is giving me error. I read the help and it states that use the variable with "&" and do it as it is mentioned.
    Can anybody suggest what I need to do to make it workable.
    Thanks

    I did try using the presentation variable, but that does not work too. I am setting session variable in the dashboard prompt (select 'request variable'). When I use presentation variable, it hard codes the value of the variable name.
    sql is
    select date from work_order where facility = @{p_facility}
    the physical log sql is
    select date from work_order where facility = 'p_facility'

  • How to use bind variables in this procedure

    Hi Experts,
    How to use bind variables in this procedure for static queries.
    PROCEDURE DELETE_MER_PROC (M_id IN NUMBER)
    IS
    BEGIN
    V_date DATE;
    SELECT PD_DATE INTO v_date FROM PD_MAINTAIN;
        DELETE FROM MER_CLEAR
        WHERE MER_DT < v_date
        AND ID = M_ID;
    COMMIT;
    END;   
    How to use  v_date and m_id as bind variables in this procedure to avoid hard parsing.
    Please help me.
    Thanks.

    976208 wrote:
    How to use  v_date and m_id as bind variables in this procedure to avoid hard parsing.
    You cannot avoid hard parsing - as the 1st time a SQL statement (like the SELECT or DELETE statements in your code) is encountered, it does not reside in the server's Shared Pool, and needs to be added into the pool via a hard parse.
    Bind variables does not prevent hard parsing. Hard parsing happens when the SQL statement (with or without bind variables) is a brand new statement encountered by the server.
    Bind variables enables the same SQL cursor to be reused, by simply changing the bind variable value.
    Not using bind variables means that each SQL statement is unique and not shareable - as the value is hardcoded into the statement and cannot be changed via a bind value. This typically means LOTS of different SQL statements (where the only difference is the changed value in the statement) are created - with each statement being a new statement not seen before in the Shared Pool and needing to be hard parsed.
    One does not design one's code not to be hard parsed. There ALWAYS will be a hard parse in order to get a SQL statement into the Shared Pool. One designs one's code to REUSE cursors in the Shared Pool.

  • How to use Bind Variables in Essbase data control

    Hi,
    I am trying to use Bind Variables in MDX query while creating the Essbase Data Control. I have used the below query with the Bind Variable.. this query is working in Essbase admin console..but it is throwing error (*Invalid MDX Query)* while creating Essbase Datacontrol in JDeveloper.
    MDX Query : SELECT {[Measures].Msr_2} ON COLUMNS, [Time].Children ON ROWS FROM cube
    where ($name)
    Could any body suggest me on how to use bind variables with Essbase Data control.
    Thanks,
    Swathi

    Hello Swathi, can you please help me how you created Essbase DataControl? Also were you able to figure out this?
    Thanks, Praveen.

  • How to use a variable on columns using Oracle Data Integrator

    How to use a variable in oracle Data Integrator expically on colums.

    yes exactly,i selected update on new column,if i didn't select update on new colum then error is not coming regarding update.
    but this time error is coming on "insert new rows".
    java.lang.NullPointerException
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.bindSessVar(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.bindSessVar(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTaskPreTrt(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java)
         at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java)
         at com.sunopsis.dwg.cmd.DwgCommandSession.treatCommand(DwgCommandSession.java)
         at com.sunopsis.dwg.cmd.DwgCommandBase.execute(DwgCommandBase.java)
         at com.sunopsis.dwg.cmd.e.i(e.java)
         at com.sunopsis.dwg.cmd.g.y(g.java)
         at com.sunopsis.dwg.cmd.e.run(e.java)
         at java.lang.Thread.run(Unknown Source).
    Can u please tell me what stpes i have to follow to solve this

  • How to use string variable onside quotes

    Hi,
    i would like to know how to use string variable onside quotes. what i mean is if i have a LOV variable P_STATUS as character string.
    and in my PL/SQL function i give a query as
    Q AS VARCHAR2(1000) := 'SELECT * FROM EMP
    WHERE STATUS = :P_STATUS';
    Is this correct. I Know that the above statement works when the LOV is an integer, but when i use a character LOV return value the above statement does not work. how can i get in the character LOV value.
    Can someone help me please.
    Thanks,
    Philip.

    916753 wrote:
    Yes I tried binding all the values separately. It is working, but, I am trying to pass all values by variableBut you can't. The variable is holding a single string value.... that is just 1 value. Your binding are expecting multiple values. You can't bind 1 string value and expect Oracle to magically know how to break your string up into seperate values for the bind variables. What if one of your bind variables actually needed e.g. a comma seperated string as it's value? How would Oracle know that?
    You must bind each thing seperately. That's the way cursors work.
    , because i have more than 150 tables in which data will be load. that's why i m trying to create a unique procedure to load data one by one table. Otherwise I have to write individual procedures for per procedures.It's a hard life being a software programmer, but somebody's got to do it. Unfortunately there are too many people who try and write "generic" procedures and expect them to just work. I mean why don't Oracle just implement some SQL command so you can do...
    execute immediate 'load all my tables';save us all the hassle eh!? ;)
    when i write all the columns like
    execute immediate (insert_string) using rc1.TOLL_ID, rc1.LANE_ID, rc1.RECEIVED_DATETIME, rc1.LANE_QUERY, c1.EXECUTED_DATETIME
    but it is not possible to generate runtime variable thats why I m trying to assign all values to a single variable and use it like
    execute immediate (insert_string) using (v_string)
    how can I separate the values and ho to use it .Don't use execute immediate. Use the DBMS_SQL package instead and bind your values dynamically with loops to cover all the columns you need etc.

Maybe you are looking for

  • Spool file problem,Can't see the query in output file.

    Hello , I am facing a very old school kind of problem .....about spool file .... The scenario - I have made a script by name DB_Status_checkup.sql which i want to fire on the database to check the database status. In this script their are many querie

  • How to create a button which scrolls down with the page automatically?

    Hello, I wanted to create a button which takes u back to the top of the page when pressed on, but I was wondering how to make it scroll down with the page on the right side automatically when some1 scrolls down the page. An example I saw was on tumbl

  • How to link a tree to a ALV table

    Hi Experts, I have a tree node on the left side of my display. Now according to the user selection on the tree node, i need to populate the ALV table on the right. That means selected value by the user is the input parameter and should fetch the corr

  • Help! Gadgets won't function on FF home page but do in IE. Why?

    I'm trying to load a gadget from igoogle into my ff home page. WHen the gadget appears I keep getting and error: can't load LM data, and other error codes. This has only happened with the last severql weeks. I am lost in thrying to get the language g

  • FolderUtils.create error

    I keep getting the error: JSP Error Exception: java.lang.NullPointerException at oracle.ifs.clients.webui.FolderUtils.create(FolderUtils.java:71) at ifs.files._ifs._jsp_2d_bin._ifs_2d_cts._jsps._createcdromfolder._jspService(_createcdromfolder.java:1