Pass Parameter to OLE DB Source

I am new to SSIS and having trouble passing parameters to OLE DB Source. I want to query data for a given date range. 
I have two variables, variable1 of data type Date Time and the value of the variable is set by expression DATEADD("day", -1, GETDATE()). variable2 of data type Date Time and the value of the variable is set by expression DATEADD("day",
0, GETDATE())
Inside the OLE DB SOURCE the data access mode is set to SQL command, below is the SQL Code.
Select Col1, col2, col3, col4, coldate where Col1 = 'abc' and  coldate between convert(varchar(10), ?, 101) and convert(varchar(10), ?, 101)
I have mapped the parameters as
Parameter0, User::variable1, input
Parameter1, User::variable2, input
When I hit preview, I get an error 
"There was an error displaying the preview
Additional Information:
No Value given for one or more required parameters. (Microsoft SQL Server Native Client 11.0)"
When I debug the task the error I get is 
[OLE DB Source [38]] Error: SSIS Error Code DTS_E_OLEDBERROR.  An OLE DB error has occurred. Error code: 0x80040E21.
An OLE DB record is available.  Source: "Microsoft SQL Server Native Client 11.0"  Hresult: 0x80040E21  Description: "Invalid character value for cast specification".
Note: The datatype for column coldate is datetime
Please help me resolve this issue.
I was able to query successfully using data access mode SQL command from variable inside OLE DB Source but I was asked not to use data access mode as SQL command.
Thank you.

There is an issue with the value in the variable for date, this happens when the date format is incorrect,
Please make sure the value in the date variable is dd-mm-yyyy format,
Please see the below steps to add the variable for OLE DB source.
Once you click on parameters , you can see the below screen, which pop's up and you can map the variable to parameter which you have declared in the query.

Similar Messages

  • ODI Procedure (passing parameter from command on source to command on target) issue.

    Hi All,
    I am working on ODI 11.1.1.5.
    I am trying to run a select query on 'command on source' and tying to capture the output into command on target and execute the code captured.
    'command on source'
    select 'BEGIN ' || 'dbms_stats.gather_table_stats(ownname => ''' || pfg.table_owner || ''', tabname => ''' || pfg.table_name || '''' ||'END' ||';'  SQL_TEXT from TABLE_GROUP pfg , ALL_TABLES at
    where pfg.enabled = 'Y'     and   pfg.group_name = 'TABLE_NAME'     and   pfg.table_owner = at.owner     and   pfg.table_name  = at.table_name  (forgot abt the syntax, i have removed some part of the code to make it simple)
    the desired output will be:  (SQL_TEXT in the above code is to capture the output into it)
    BEGIN dbms_stats.gather_table_stats(ownname => 'OWNER_NAME', tabname =>  'TABLE_NAME', estimate_percent =>  DBMS_STATS.AUTO_SAMPLE_SIZE, degree =>  DBMS_STATS.DEFAULT_DEGREE); END;
    I am getting the desired result , the only problem is passing on this to 'command on target'. On "comm on target", I wanted to run this whole output (from BEGIN to END, as above) so I followed the below syntax/method of calling/executing this:
    :SQL_TEXT (did not work)
    #SQL_TEXT  (did not work)
    Any help on this is much appreciated. thanks in advance.
    Regard,Sp.

    It will not work like that. you have to either store the variable value in other variable and then use that.
    or
    write command on source like
    select pfg.table_owner SQL_TEXT1,pfg.table_name SQL_TEXT from TABLE_GROUP pfg , ALL_TABLES at
    where pfg.enabled = 'Y'     and   pfg.group_name = 'TABLE_NAME'     and   pfg.table_owner = at.owner     and   pfg.table_name  = at.table_name
    command on target/ technology --> oracle
    BEGIN
    dbms_stats.gather_table_stats(#SQL_TEXT1 || #SQL_TEXT)
    END
    I have not try out this before but i believe it will work.
    let me know
    Thanks

  • How to handle comma separated values in OLE DB Source query for a parameter variable from XML file in SSIS

    Hi,
    I am using OLE DB Source to fetch the records with Data Access Mode as SQL COMMAND which is using the below query with a parameter,
    SELECT CON.Title,CON.FirstName,EMP.MaritalStatus,EMP.Gender,EMP.Title AS Designation, EMP.HireDate, EMP.BirthDate,CON.EmailAddress, CON.Phone
    from HumanResources.Employee EMP INNER JOIN Person.Contact CON ON EMP.ContactID=CON.ContactID WHERE EMP.Title in (?) 
    In this query for the parameter I am passing the value from a variable and which is configured (XML Configuration). While passing value
    Buyer it works correctly. But while passing values Accountant,Buyer
    it is not working as expected.
    How to handle while passing such multiple values Or is it possible to pass such values or not in SSIS 2012 ?
    Kindly help me to find a solution.
    NOTE: I placed the whole query in a variable as a expression as below it is working fine.
    "select CON.Title,CON.FirstName,EMP.MaritalStatus,EMP.Gender,EMP.Title AS Designation,EMP.HireDate,EMP.BirthDate,CON.EmailAddress,CON.Phone from HumanResources.Employee EMP
    INNER JOIN Person.Contact CON ON EMP.ContactID=CON.ContactID WHERE EMP.Title in ('" + REPLACE(@[User::temp],",","','")  +"')"
    Any other solution is there ? without placing the query in a variable. May be a variable can have some limitations for no. of characters stored not sure just a thought.
    Sridhar

    Putting the whole thing into a variable is certainly a valid solution.  The other involves putting the comma delimited list into a table valued variable.
    http://gallery.technet.microsoft.com/scriptcenter/T-SQL-Script-to-Split-a-308206f3
    For an odd ball approach: 
    http://www.sqlmovers.com/shredding_multiline_column_using_xml/ .
    Russel Loski, MCT, MCSE Data Platform/Business Intelligence. Twitter: @sqlmovers; blog: www.sqlmovers.com

  • How to pass parameter into a source variable of a invoke activity

    I'm an new BPELer, I created a invoke activity to submit Oracle Appplications concurrent program, but I don't know how to pass parameter into source variable.
    BTW, I have created the mapper file (.xsl) file.
    could anyone tell me how to do that?
    Thanks,
    Victor

    Hi.
    How you start application? I think you send message to webservice(BPEL process is webservice too). So construct message with variable and value.
    But I created only processes where input value doesn't matter. I haven't use mapper yet too.

  • Pass Parameter to IN Operator in SQL Command in OLEDB source

    Hi,
    I am trying to pass multiple values as one parameter. Eg: I need to get the employess with gender in ('M','F')
    query: select eno, ename, sal, gender from emp where gender in (?)
    Created a variable 'varGender' with the value - 'M','F'
    And passed the parameter mapping in OLEDB Source. But this is not returning any records.
    Please advise.
    Thanks.

    Hi Vaibhav,
    Thanks for your kind reply.
    I need to pass the same where condition to multiple source queries and we don't want to repeat the same condition in all queries and replace with a variable. Also the query is too big to keep it in the Variable. Please help me.
    Thanks
    Put the required filter values in a staging table and then use it in a join condition with all the other tables in all the other tasks.
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • SSIS OLE DB Source in Data Flow Task calling SP that returns variable number of column as output

    We have one old Stored Proc that I need to reuse. But that stored proc returns different number of Columns as output depending on input Parameter. Say, if I pass 1 to 9 it will return 'ID', if i pass 10 to 33 it will return 'ID', 'Name',  if I pass
    34 to 51 it will return 'ID', 'Name', 'DefaultPosition' 
    In this way.
    Now I wanted to use this in OLE DB Source in SSIS DFT. 
    During that time immediately it is picking all possible columns in Available External Columns. Even if I manually select/delete those, package is failing at Runtime, because in Runtime the parameter this will get, it should always return one & only one
    column which is ID. [Because in this package I will only have to pass parameters like, 1 or 2 or 5 or 7 or 9.
    Which in every  case should return only ID from stored proc.
    Any Idea how I can get this please?
    Regards, Avik M.

    Has any one tried something like it? Could you please provide me a sample if you have done it.
    I tried these options but always got errors as
    [usp_return [64]] Error: SSIS Error Code DTS_E_OLEDBERROR.  An OLE DB error has occurred. Error code: 0x80040E55.An OLE DB record is available.  Source:
    "Microsoft SQL Server Native Client 10.0"  Hresult: 0x80040E55  Description: "Column does not exist.".
    [SSIS.Pipeline] Error: SSIS Error Code DTS_E_PRIMEOUTPUTFAILED.  The PrimeOutput method on component "usp_return" (64) returned error code 0xC0202009.  The component returned a failure code when the pipeline engine called PrimeOutput(). The meaning
    of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing.  There may be error messages posted before this with more information about the failure.
    ~ Thank you so much
    Regards, Avik M.

  • 'Driver]Parameter missing' Error while trying to pass parameter to MS query & Return Data to Microsoft Excel

    I am trying to set up a parameter query using ODBC-Microsoft Query
    to BMC Remedy The ODBC connection is "AR System ODBC Data Source".
    I want to pass a parameter to modified date field and get all the remedy tickets for which the modified date is<= to the passed parameter date.
    So in MS query, SQL- 
    the query looks like
     WHERE ("Trouble Ticket"."Create Date">={ts '2014-10-01 00:00:00'}) AND ("Trouble Ticket"."Modified-date"<=?)
    I am getting the data fetched from database in the MS query window, but unfortunately
    When I click File-Return Data to Microsoft Excel, its showing an error: Driver]Parameter missing
    I set the connection properties- parameter-Prompt for value using the following string.
    Please help

    Hi,
    Based on the error message, I recommend we try the suggestion: Replace all "..."  with [...]
    http://www.pcreview.co.uk/forums/error-parameter-query-odbc-remedy-bmc-software-com-t3232964.html
    Then, if you want to connect the Remedy's oracle database, please see the thread:
    http://www.tek-tips.com/viewthread.cfm?qid=1123112
    We may try the workaround: Write an Excel macro which connects to the database and fetch the data based on the SQL query.
    Please Note: Since the web site is not hosted by Microsoft, the link may change without notice. Microsoft does not guarantee the accuracy of this information.
    If you have further question about write macro, I recommend you post the question to the MSDN forum for Excel
    http://social.msdn.microsoft.com/Forums/en-US/home?forum=exceldev&filter=alltypes&sort=lastpostdesc
    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.
    George Zhao
    TechNet Community Support
    It's recommended to download and install
    Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
    programs.

  • Passing Parameter to XSL document (in XDK forPL/SQL)

    Here i' trying to pass parameters to my XSL document.But the value is not getting populated in the final document, can anyone help me on this.,.?
    // This is how i 'm passing parameter value to the XSL
    xslprocessor.setParam (styles,'p_batch_name','batch1');
    // Applyting stylesheet(xsl) with XMLdoc and storing it in a DOM node
    docn := xmldom.makeNode(xslprocessor.processXSL(engine,styles,doc));
    My XSL is like this
    <INSERT xsl:version="1.0" xmlns:xsl ="http://www.w3.org/1999/XSL/Transform">
    <xsl:param name="p_batch_name"/>
    <ROWSET table="abc">
    <xsl:for-each select="rowset/row">
    <ROW>
    <batch_name>"{$p_batch_name}"</batch_name>
    </ROW>
    <xsl:for-each>
    </ROWSET>
    <INSERT>
    But in the final document, the value (batch1) is not getting
    populated. it is coming as null .
    Can anyone help me ...
    null

    This does not work because of the following two things:
    [list=1]
    [*]The value of a parameter is interpreted as an XPath expression. Passing a value of batch1 will be interpreted as the XPath expression batch1 that will try to match any <batch1> child elements of the root of the source document. You need to include the value in quotes to have it be interpreted as a literal string:xslprocessor.setParam (styles,'p_batch_name','"batch1"');[*] The setParam method can only set the value of "top-level" stylesheet parameters. In your stylesheet, you've illegally used <xsl:param> inside a template. You need to switch from the "simple form" of a stylesheet to the "normal form" of the stylesheet to use a top-level parameter. So instead of:<INSERT>
    </INSERT>
    [code]
    you need instead:
    [code]
    <xsl:stylesheet>
    <xsl:template match="/">
    <INSERT>
    </INSERT>
    </xsl:insert>
    </xsl:stylesheet>[list]
    null

  • Passing parameter to report title

    I am working with drill down report. My master ( Source ) report has
    Emp #, Emp Name, Address columns.
    I have prompt on Emp Name column. My second (target) has other employee details and report title is “ Individual Detail report for Employee” but my user is asking they want to display report name with employee name .( passing parameter to report title) . I mean in source report if I click on “Roy Rine” target report should display with following title
    “Individual Detail report for Roy Rine”
    Can I do this one with OBIEE? Please help me.
    Thanks for your time

    Its working but it is repeating names . i mean i have 4 people hvae name "Roy Jermon" . if i click on this column
    report is displaying ' INDIVIDUAL REPORT FOR ROY JERMON ROY JERMON ROY JERMON ROY JERMON"
    is ther any way we can control for only one time even if we have mutiple values.
    i am really appriciate for your time.

  • Looking for a way to pass parameter to external list from infopath

    Hey, i have a Sharepoint 2010 list for which I want to create Infopath form. I have an external content type and external list based on it.
    I want to prepopulate some fields in my Sharepoint list with data from external list. I tried to use external list as a secondary data source and query it for needed values. The issue I encounter is that my ECT has a finder with filter and I can't figure
    out how to pass a value to this filter within infopath.
    How can it be done with infopath? How can I pass the filter value to the external list using Infopath?

    Hi,
    According to your post, my understanding is that you wanted to pass parameter to external list from infopath.
    You need to query the external list from InfoPath using coding and CAML Query.
    Here is a similar thread for your reference:
    http://sharepoint.stackexchange.com/questions/33575/filtering-sharepoint-external-list-bcs-from-infopath
    Thanks,
    Linda Li
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Linda Li
    TechNet Community Support

  • How to pass parameter to my jsp apge included in adf inlineframe

    Hi,
    I would like to know how could i pass parameter to my adf inileframe src.
    Because when i try to do this
    <af:inlineFrame id="if1" source="/frontBackOffice/Scanning.jsp?param0=#{....}&param1=#{....}" />
    I have a error
    ADF_FACES-30179:Pour plus d''informations, consultez le journal d''erreur du serveur à une entrée commençant par : l''élément UIViewRoot est NULL. Exception fatale lors de PhaseId : RESTORE_VIEW 1
    Could you help me please

    you map the source to a backingbean.. and in the bean you just manipulate the parameters..
    chk this link for an idea - search for af:inlineframe
    http://biemond.blogspot.com/2009/02/facebook-adf-task-flow.html
    <af:inlineFrame source="#{FaceBook.facebookLoginUrl}" 
                         inlineStyle="width:99%; height:99%;" 
                         shortDesc="Loginpage"/> 
    in the bean do this
    private String facebookLoginUrl;
    public String getFacebookLoginUrl() { 
          if (sessionID==null){ 
            try { 
                  client = new FacebookJaxbRestClient(APIKEY, SECRET); 
                  token = client.auth_createToken(); 
                  facebookLoginUrl= "http://api.new.facebook.com/login.php?api_key=" + APIKEY + "&v=1.0&auth_token=" + token; 
             } catch (FacebookException ex) { 
              ex.printStackTrace(); 
          return facebookLoginUrl; 
      }

  • Import statement: pass parameter or variable in import statement ??

    Hi All..
    Is there a way to pass parameter or a variable to a url in the import statement..
    I'll be using a url in the import statement, the url will be having a dynamic .rtf file...something like
    <?import:http://#server#:#port#/xmlpserver/<mySubTemplate>.rtf?>
    where <mySubTemplate> is dynamic..
    I've been searching this thread for a while now and ended up close...
    Import sub template dynamically
    Thanks in Advance..

    Have you tried replacing the mySubtemplate.rtf part with a variable, or replace the entire URL using a variable? Try using the same construct from this example in the Report Designer's guide (page 7-14, 10.1.3.4).
    In Microsoft Word's Format Picture dialog box select the Web tab. Enter the
    following syntax in the Alternative text region to reference the image URL:
    url:{IMAGE_LOCATION}
    where IMAGE_LOCATION is an element from your XML file that holds the full
    URL to the image.
    You can also build a URL based on multiple elements at runtime. Just use the
    concat function to build the URL string. For example:
    url:{concat(SERVER,'/',IMAGE_DIR,'/',IMAGE_FILE)}
    where SERVER, IMAGE_DIR, and IMAGE_FILE are element names from your XML
    file that hold the values to construct the URL.
    This method can also be used with the OA_MEDIA reference as follows:
    url:{concat('${OA_MEDIA}','/',IMAGE_FILE)}

  • Pass parameter from request

    Hi,
    I have 2 pages, in page2 CO2, it passes parameter 'cancel'
    processFormRequest{
    else if("Cancel".equals(pageContext.getParameter("event")))
    pageContext.putParameter("cancel", "Y");
    pageContext.forwardImmediately("OA.jsp?page=/company/oracle/apps/xxg2c/goaling/webui/Xxg2cGoalSheetSearchePG",
    null,(byte)0,null,null,true,null);
    in page1, CO1, I get the parameter 'cancel'.
    processRequest{
    cancel = pageContext.getParameter("cancel");
    Now, if I want pass 'cancel' to processFormRequest of CO1, how should I do it?
    thanks
    Lei

    Lei,
    To get the value in co1, there are two alternatives:
    1)Pass value in hashmap:
    HashMap hmap= new HashMap();
    hmap.put("cancel","Y");
    pageContext.forwardImmediately("OA.jsp?page=/company/oracle/apps/xxg2c/goaling/webui/Xxg2cGoalSheetSearchePG",
    null,(byte)0,null,hmap,true,null);
    in page1, CO1 processRequest, you can get it by
    cancel = pageContext.getParameter("cancel");
    2)Pass param in url itself:
    pageContext.forwardImmediately("OA.jsp?page=/company/oracle/apps/xxg2c/goaling/webui/Xxg2cGoalSheetSearchePG&cancel=Y",
    null,(byte)0,null,null,true,null);
    in page1, CO1 processRequest, you can get it by
    cancel = pageContext.getParameter("cancel");
    --Mukul                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Issue on How to mimic Deski document from CMS to local machine, pass parameter, execute and save in a mutiple report format then store in a network drive.

    Post Author: usaitconsultant
    CA Forum: JAVA
    Would you know if there's a way to mimic Deski
    document from BOXI server(CMS) to local machine, pass parameter, execute and
    save in a mutiple report format then store in a local drive or network
    drive? Most examples and tutorials in BO XI R2 I've seen are scheduling while drilling report is for web intelligence only and not desktop intelligence.  Please let me know your ideas. I would really appreciate your help. Thanks.

    Post Author: usaitconsultant
    CA Forum: JAVA
    Hi Ted,
    Thanks for the reply.The file is not available in the server. Though, I checked CMS and I found an instance in history tab and the status is failed with error below. 
                Error Message:
                A variable prevented the data provider Query 1 with BANRRD30 from being refreshed. (DMA0008).When I checked my codes, I found out that the object Im using is for web intelligence data provider. However, I cannot find any documentation and example for passing parameter values in desktop intelligence data provider. Any idea on this? You think this is not suported by Report Engine SDK?Thanks.    

  • How to get month value from custom calendar without passing parameter from SSRS in MDX query

    Could you please throw some light to achieve below requirement?  
    I need to filter the data between two periods dynamically . The date calendar here works differently(ex:-Date 26-Aug-2014 will fall in period 7 which is last date and 27-Aug-2014 will fall in period 8 and it is first date of period 8),so I cannot go
    with system date period/Month. Date Hierarchy is like YEAR,QUARTER,PERIOD ,WEEK and DAY.
    I cannot use SSRS for passing parameter. Requirement is to extract last 2 period of data dynamically in Power Pivot with MDX.
    Thanks Chandan

    Hi Chandan,
    You might try something like this
    Tail(null:
    Extract(
    StrToMember("[FYDay].[DATE].&[ + cStr(Format(Now(),"yyyy-MM-ddT00:00:00")) + "]")
    *[FYDay].[DateHierarchy].[Day]
    ,[FYDay].[DateHierarchy]).parent.parent
    ,2)
    What it is doing is multiplying Day by the current date, which returns a set of one date with cardinality of (Date,Day).  The Extract is pulling out just the datehierarchy Day.  the the Tail() is getting it and the previous day.
    Hope that helps,
    Richard

Maybe you are looking for

  • External monitor not detected

    I just got a Samsung SyncMaster 2033 SW Plus monitor and tried connecting through the DVI port of my MacBook Pro, but its not getting detected. I'm using the mini display port to DVI adapter to connect. The monitor seems to work perfectly when I conn

  • ITunes says iPad is supervised by another computer?

    I have a school distributed iPad and they gave us the freedom to put music on it. However, when I plug in my iPad into my PC, an error message comes up and says, 'iPad is supervised by another computer and cannot be used with this computer,' and then

  • Query regarding RFC Call from R3 to BW

    Hi i have one scenario. during running the delta program in R3, and at the end of the code, send an RFC message to BW, which can trigger a job in BW which will start 1 meta chain. please let me know how this can be done and what ABAP code needs to be

  • In case someone has a login loop with Mac Lion

    Yesterday I had a login loop on my Mac Lion. I spent about 10 hours reading forums and interpretating the system logs, but nothing. Tried to log-in, then grey screen for a second, then back to the log-in screen. So, in this scenario I managed to have

  • Adobe Photoshop Elements 12 is on sale.

    How do I buy it as a gift?