How do I Send in a value to the SQL Query Expression's variable created using Declare in Power Query

I have gone through the other posts where in a parameter is sent to query created by power query but my ask is a bit different. 
I am using a sql query to retrieve data using Power query which has 2 variables declared in the DECLARE section in the query. 
Ex: 
declare @Name varchar(1000)
SET @Name= 'Alpha'
declare @location nvarchar(1000)
SET @location= 'Bravo'
Select * from Infotable where Name = @Name and location = @location. 
Now in the following query I would want to send in the values for  the declared variables using a table in my worksheet. I have followed the stuff present in the following post 
http://blog.oraylis.de/2013/05/using-dynamic-parameter-values-in-power-query-queries/
but when using the value name (let Name_parameter = Excel.Currentworkbook(), Name_Value = Name_Parameter [0][value]) in the Advance Editor as mentioned in the above post I am being thrown an error stating  Name_Value column doesn't exist.
I am having a tough time figuring out what the problem could be..

I have gone through the other posts where in a parameter is sent to query created by power query but my ask is a bit different. 
I am using a sql query to retrieve data using Power query which has 2 variables declared in the DECLARE section in the query. 
Ex: 
declare @Name varchar(1000)
SET @Name= 'Alpha'
declare @location nvarchar(1000)
SET @location= 'Bravo'
Select * from Infotable where Name = @Name and location = @location. 
Now in the following query I would want to send in the values for  the declared variables using a table in my worksheet. I have followed the stuff present in the following post 
http://blog.oraylis.de/2013/05/using-dynamic-parameter-values-in-power-query-queries/
but when using the value name (let Name_parameter = Excel.Currentworkbook(), Name_Value = Name_Parameter [0][value]) in the Advance Editor as mentioned in the above post I am being thrown an error stating  Name_Value column doesn't exist.
I am having a tough time figuring out what the problem could be..

Similar Messages

  • Cannot enter correct values in the SQL server express 2012 using labview

    Hi everyone,
    I am trying to enter the 2D array I get from DAQ into the SQL server express 2012 using Labview. When I am run the software, it connects with the table but doesn't enter the correct values. It only enters the "0" for each column of the table. I have attached the VI as well as the screenshot from the database server. 
    I am also writing the same 2D array data into the text file and I get the correct readins there. 
    Is there something I am doing wrong here. 
    Attachments:
    test.png ‏251 KB
    test3.vi ‏96 KB

    If you had read the QL manuals or reference books, you would be aware SQL Server doesn't do multidimensional arrays.
    I prefer BLOBs or VARCHAR(MAXCHAR) as an alternative. I enter the values in formatted string values delimiter separated.
    But how to deal with multidimensional arrays. Well up to 3-5 you can use simple value for each "dimension". So the lowest dimension
    would be comma delimit. The next set of values and each succeeding set for each 2nd dimension values would have the "set" of values separated
    by a ":" or semicolon. For the third I use the ":" or colon to separate each 2D block of the 3rd dimension. This can all be easily reparsed
    with a multidimensional parser for the application. Should be simple to build. (e.g.. Use string arrays to parse the higher dimensions
    and numeric array for the lowest dimension). The VARCHAR(MAXCHAR) has an upper data bound of 2GB! If you have to save more
    than 3 dimensions for most all applications, you don't understand how best to analyze the test data and may want to give it more 
    thought to optimize the operation as well as the design, so it doesn't get too complex. By the way I use Data Clusters built in the
    data order and type as for SQL Server Data Table. This makes the design of the SQL Server interface easy as pie .

  • How can i pass the Input value to the sql file in the korn shell ??

    Hi,
    How can i pass the Input value to the sql file in the korn shell ??
    I have to pass the 4 different values to the sql file and each time i pass the value it has to generate the txt file for that value like wise it has to generate the 4 files at each run.
    can any one help me out.
    Raja

    Can you please more elaberate., perhaps you should more elaberate.
    sqlplus is a program. you start it from the korn shell. when it's finished, processing control returns to the korn shell. the korn shell and sqlplus do not communicate back and forth.
    so "spool the output from .sql file to some txt file from k shell, while passing the input parameters to the sql file from korn shell" makes no sense.

  • How do I pass a null value to the reportDocument?

    I'm using CR 2008 and VS 2005. 
    I am using a stored procedure as the datasource for one of my report, which we run using the C# API.   The stored procedure is expecting a NULL in certain cases and I find I cannot pass a NULL with my current code:
    // Here I get the parameter
    // If we are dealing with an empty string or a NULL value, let's give it
                            // a value of a space so that Crystal's DLLs don't choke.
                            if ((value.Length == 0) || (value == "NULL"))
                                value = " ";
                            arrParams.Add(value);
    Object strParam = arrParams<i>;
    this.reportDocument1.SetParameterValue(num, strParam);
    The stored procedure parameter type is INT so in the report it shows up as NUMBER.
    How do I get a NULL value to the stored procedure?
    Thanks.

    See if this does the trick:
    Dim crParameterDiscreteValue As New CrystalDecisions.Shared.ParameterDiscreteValue()
    crParameterDiscreteValue.Value = Nothing
    C# would look something like;
    CrystalDecisions.Shared.ParameterDiscreteValue crParameterDiscreteValue;
    crParameterDiscreteValue = new CrystalDecisions.Shared.ParameterDiscreteValue();
    crParameterDiscreteValue.Value = null;
    Ludek
    Follow us on Twitter http://twitter.com/SAPCRNetSup

  • How can i transfer a field value in the main report to its sub-report?

    <p><font face="Arial" size="2">How can i transfer a field value in the main report to its sub-report?</font></p><p><font face="Arial" size="2">Please eloberate with example if possible!</font></p><p><font face="Arial" size="2">Thanks...</font></p><p> </p>

    <p>You can do a couple of things - one would be to pass the information using the data linking expert.  Right click on the subreport, choose &#39;Change Subreport Links&#39; and select the field(s) you are wanting to pass to the subreport.  CRW will build parameters and a record selection formula for you in the subreport, and if that&#39;s what you want, then great.  But you can also remove the selection formula from the subreport and work with the parameter fields in the subreport however you would like.</p><p>Alternatively, you can look to passing Shared variables back and forth from the main and subreport.  this link talks about the method to do this: http://diamond.businessobjects.com/node/251</p><p> </p>

  • How can I send an XML request to the server using servlets

    How can I send an XML request to the server using servlets

    http://forum.java.sun.com/thread.jspa?threadID=5158333
    http://forum.java.sun.com/thread.jspa?threadID=5158705
    Crossposting is lame.

  • How to pass the bind variable value to the sql statement of the LOV

    Hi,
    I am using Forms 10g builder.
    I have a text item which will be populated by a LOV when i press a button, but i have a bind variable in the SQL statement of the LOV. That bind variable should be replaced by a value which is derived from a radio group in the same data block.
    For Ex: ( )radio1 ( )radio2
    before i click on the push button, I'll select one of the radio button above,so my question is how to assign this radio group value to the bind variable in the sql statement in the LOV?
    Pl any hint is appreciated!
    Thanks
    Reddy

    The variable can be taken into account in the SELECT order contained in the Record Group used by the LOV.
    e.g. Select ... From ... Where column = :block.radio_group ...Francois

  • My friend has an iPhone but doesn't use iMessage. How can I send her regular texts with the new iOS 7 update?

    My friend has an iPhone but doesn't use iMessage. How can I send her regular texts with the new iOS 7 update?

    That's because her phone is recognized in the Apple database as an iPhone.  It should eventually convert to SMS but that's above my level of expertise here so hopefully someone else can come along and help you further.  She could just turn on iMessage and solve the problem. Ha!
    Good luck!

  • State machine custom task workflow how to pass one task field value to the next task field

    i am using ItemMetadata.xml to pass value from list to custom task first value its passing the but second value is showing as null
    plus how to pass one custom task value to the next custom task
    i.e one supervisor approver comments submitted field i want to see on department manager approval custom task which is the next approver from supervisor
    ows_firstfield=""
    ows_SecondField=""
    the above ows fields are from list
    in this i am unable to retrive the second value in the task form this is my first query?
    second query is that how can we pass one task field value to next approver task field value?
    any idea
    MCTS,ITIL

    What type of workflow is this?  IS this Visual Studio or SharePOint designer or third party (K2, Nintex, etc...)?  YOu should be able to get ahold of the task that was edited via the correlation token, and then grab any value you want from that
    task (wether it be a custom field or a standard worfklow task field). 
    It would help to know what you are using to build the workflow.
    Thanks!

  • How to add byte[] array based Image to the SQL Server without using parameter

    how to add byte[] array based Image to the SQL Server without using parameter.I have a column in table with the type image in sql and i want to add image array to the sql image column like below:
    I want to add image (RESIM) to the procedur like shown above but sql accepts byte[] RESIMI like System.Drowing. I whant that  sql accepts byte [] array like sql  image type
    not using cmd.ParametersAdd() method
    here is Isle() method content

    SQL Server binary constants use a hexadecimal format:
    https://msdn.microsoft.com/en-us/library/ms179899.aspx
    You'll have to build that string from a byte array yourself:
    byte[] bytes = ...
    StringBuilder builder = new StringBuilder("0x", 2 + bytes.Length * 2);
    foreach (var b in bytes)
    builder.Append(b.ToString("X2"));
    string binhex = builder.ToString();
    That said, what you're trying to do - not using parameters - is the wrong thing to do. Not only it is insecure due to the risk of SQL injection but in the case of binary data is also inefficient since these hex strings are larger than the original byte[]
    data.

  • ORA-33858: The value of the ampersand-substitution expression is NA." Cube

    Hi David ,
    While deleting a cube I am gettingbelow error . Any reason as the error is not easy to understand .
    The transaction is not committable: "An error has occurred on the server
    Error class: Express Failure
    Server error descriptions:
    DPR: cannot create server cursor, Generic at TxsOqDefinitionManager::generic<CommitRoot>
    INI: XOQ-01600: OLAP DML error "ORA-33858: The value of the ampersand-substitution expression is NA." while executing DML "SYS.AWXML!R11_MANAGE_CUBE('BASE_PLAN_AGGR.CUBE' 'DELETE')", Generic at TxsOqStdFormCommand::execute
    at oracle.olapi.transaction.BaseTransaction.commit(Unknown Source)
    at oracle.olapi.transaction.BaseTransactionProvider.commitCurrentTransaction(Unknown Source)
    at oracle.olap.awm.dataobject.DatabaseDO.commitOLAPI(Unknown Source)
    at oracle.olap.awm.dataobject.aw.WorkspaceDO.commitOLAPI(Unknown Source)
    at oracle.olap.awm.dataobject.olapi.UModelDO.commitOLAPI(Unknown Source)
    at oracle.olap.awm.dataobject.olapi.UModelDO.delete(Unknown Source)
    at oracle.olap.awm.dataobject.olapi.UCubeDO.delete(Unknown Source)
    at oracle.olap.awm.navigator.node.DeleteThread.run(Unknown Source)
    Many thanks,
    DxP

    Hi David ,
    Now we are getting the same problem while adding one of the dimension to our cube . Before addition of that dimension the cube was running fine . Now if we add this and click apply then it is throwing the same error . However that dimension has been used in different cube in same workspace and it is perfectly fine there.
    Not able to understand the cause and the problem for the addition of new dimension there .
    Any clue ? or same BUG /
    Rgds,
    DxP

  • How do I send a blank value to a MailMerge data file cell

    I have a Client_OLE2 process that loads individual data cells used for mailmerging to a word document. The process loads a cell, moves on to the next cell and loads that with data.
    Everything works fine until I try and load a cell with a blank or a null. The process stops dead and issues a 100501 exception.
    Is there a work around for trying to load blanks or nulls into data file cells?
    A sample of my code is below: (Say for example that 'ADDRESS2' is blank)
    APPLICATION := CLIENT_OLE2.CREATE_OBJ('Word.Application');
    CLIENT_OLE2.SET_PROPERTY(APPLICATION,'Visible', 1); -- VBA CODE
    WORD.APP := APPLICATION;
    WORD.SEL := CLIENT_OLE2.GET_OBJ_PROPERTY(WORD.APP,'SELECTION');
    args:=CLIENT_OLE2.create_arglist;
    CLIENT_OLE2.add_arg(args,3); --Unit :=wdCell
    CLIENT_OLE2.add_arg(args,1); --Count:=1
    --- Insert GOVERNOR_NAME name
    CLIENT_OLE2.SET_PROPERTY(WORD.SEL,'Text',GOV_NAME);
    CLIENT_OLE2.INVOKE(WORD.SEL,'Move',args);
    --- Insert sysdate "Letter Date"
    CLIENT_OLE2.SET_PROPERTY(WORD.SEL,'Text',LETTER_DATE);
    CLIENT_OLE2.INVOKE(WORD.SEL,'Move',args);
    --- Insert INMATE_NAME_NUMBER OR ATTORNEY NAME
    CLIENT_OLE2.SET_PROPERTY(WORD.SEL,'Text',NAME_1);
    CLIENT_OLE2.INVOKE(WORD.SEL,'Move',args);
    --- Insert PRISON_NAME OR ATTORNEY FIRM NAME
    CLIENT_OLE2.SET_PROPERTY(WORD.SEL,'Text',NAME_2);
    CLIENT_OLE2.INVOKE(WORD.SEL,'Move',args);
    --- Insert PRISON_ADDR1 OR ATTORNEY ADDRESS1
    CLIENT_OLE2.SET_PROPERTY(WORD.SEL,'Text',ADDRESS1);
    CLIENT_OLE2.INVOKE(WORD.SEL,'Move',args);
    --- Insert PRISON_addr2 OR ATTORNEY ADDRESS2
    CLIENT_OLE2.SET_PROPERTY(WORD.SEL,'Text',ADDRESS2);
    CLIENT_OLE2.INVOKE(WORD.SEL,'Move',args);
    CLIENT_OLE2.destroy_arglist(args);
    Any advice would be appreciated. thanks

    Hi,‮
    It is actually possible to do this on a computer.
    Copy whatever is in the spoiler tag and send it to him.  The text is very small, but it's still there.
    Spoiler (Highlight to read)
    If my post above answered your question, please click "Accept as Solution". Also feel free to give Kudos to my post if you found it helpful.
    Also — I’m back!
    Thanks and kind regards.

  • How do I get a new value for the service name field and update it in Connection Properties?

    I am running Windows Vista. I just upgraded to Firefox 4. When I try to log on to the internet, it tells me the proxy server is refusing connections. A diagnostic reported Error 815 and said the remote server is not responding because there is an invalid value for the "Service Name" field. It said to get a new value and update it in Connection Properties. How do I do this?

    When you create a new film script, the first page you see is a title page.
    The page after this title page is the one where you generally type in your scenes.
    It looks like you are facing some issue and not able to delete any text.
    Can you please send me this script so that I can have a better look at your issue?
    You can save this script to disk by using option 'File -> Save to disk'. This will create a '.stdoc' file on your system.
    Just mail this '.stdoc' file to me at 'roverma <at> adobe <dot> com'
    Thanks

  • [Forum FAQ] How do I send multiple rows returned by Execute SQL Task as Email content in SQL Server Integration Services?

    Question:
    There is a scenario that users want to send multiple rows returned by Execute SQL Task as Email content to send to someone. With Execute SQL Task, the Full result set is used when the query returns multiple rows, it must map to a variable of the Object data
    type, then the return result is a rowset object, so we cannot directly send the result variable as Email content. Is there a way that we can extract the table row values that are stored in the Object variable as Email content to send to someone?
    Answer:
    To achieve this requirement, we can use a Foreach Loop container to extract the table row values that are stored in the Object variable into package variables, then use a Script Task to write the data stored in packages variables to a variable, and then set
    the variable as MessageSource in the Send Mail Task. 
    Add four variables in the package as below:
    Double-click the Execute SQL Task to open the Execute SQL Task Editor, then change the ResultSet property to “Full result set”. Assuming that the SQL Statement like below:
    SELECT   Category, CntRecords
    FROM         [table_name]
    In the Result Set pane, add a result like below (please note that we must use 0 as the result set name when the result set type is Full result set):
    Drag a Foreach Loop Container connects to the Execute SQL Task. 
    Double-click the Foreach Loop Container to open the Foreach Loop Editor, in the Collection tab, change the Enumerator to Foreach ADO Enumerator, then select User:result as ADO object source variable.
    Click the Variable Mappings pane, add two Variables as below:
    Drag a Script Task within the Foreach Loop Container.
    The C# code that can be used only in SSIS 2008 and above in Script Task as below:
    public void Main()
       // TODO: Add your code here
                Variables varCollection = null;
                string message = string.Empty;
                Dts.VariableDispenser.LockForWrite("User::Message");
                Dts.VariableDispenser.LockForWrite("User::Category");
                Dts.VariableDispenser.LockForWrite("User::CntRecords");     
                Dts.VariableDispenser.GetVariables(ref varCollection);
                //Format the query result with tab delimiters
                message = string.Format("{0}\t{1}\n",
                                            varCollection["User::Category"].Value,
                                            varCollection["User::CntRecords"].Value
               varCollection["User::Message"].Value = varCollection["User::Message"].Value + message;   
               Dts.TaskResult = (int)ScriptResults.Success;
    The VB code that can be used only in SSIS 2005 and above in Script Task as below, please note that in SSIS 2005, we should
    change PrecompileScriptIntoBinaryCode property to False and Run64BitRuntime property to False
    Public Sub Main()
            ' Add your code here
            Dim varCollection As Variables = Nothing
            Dim message As String = String.Empty
            Dts.VariableDispenser.LockForWrite("User::Message")
            Dts.VariableDispenser.LockForWrite("User::Category")
            Dts.VariableDispenser.LockForWrite("User::CntRecords")
            Dts.VariableDispenser.GetVariables(varCollection)
            'Format the query result with tab delimiters
            message = String.Format("{0}" & vbTab & "{1}" & vbLf, varCollection("User::Category").Value, varCollection("User::CntRecords").Value)
            varCollection("User::Message").Value = DirectCast(varCollection("User::Message").Value,String) + message
            Dts.TaskResult = ScriptResults.Success
    End Sub
    Drag Send Mail Task to Control Flow pane and connect it to Foreach Loop Container.
    Double-click the Send Mail Task to specify the appropriate settings, then in the Expressions tab, use the Message variable as the MessageSource Property as below:
    The final design surface like below:
    References:
    Result Sets in the Execute SQL Task
    Applies to:
    Integration Services 2005
    Integration Services 2008
    Integration Services 2008 R2
    Integration Services 2012
    Integration Services 2014
    Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.

    Thanks,
    Is this a supported scenario, or does it use unsupported features?
    For example, can we call exec [ReportServer].dbo.AddEvent @EventType='TimedSubscription', @EventData='b64ce7ec-d598-45cd-bbc2-ea202e0c129d'
    in a supported way?
    Thanks! Josh

  • How to pass more than one value to the procedure

    How can I pass more than one letting date to this procedure. If it is only one letting date, I do not have a problem but when it is more than one letting date at the same time then I am stuck. please help
    example I would like to pass this three letting dates : '01/17/2010', '01/27/2010','05/22/2010'
    CEATE OR REPLACE PROCEDURE TPLCP.PLANHOLDERSLIST
    P_LettingDate IN  VARCHAR2,
    p_results OUT sys_refcursor
    AS
    BEGIN
        OPEN p_results FOR
    SELECT DISTINCT DECODE (TRIM (MIN (j.route)), NULL, 'N/A',TRIM (MIN (j.route))) rt,l.lcontid conid,
                     SUBSTR (q.cprojnum, 1, 10) pr, SUBSTR (l.letting, 3, 2)|| '-'|| SUBSTR (l.letting, 5, 2)|| '-'|| SUBSTR (l.letting, 1, 2) lt,
                    (q.cdescr) jbtyp, INITCAP (q.clocat1 || q.clocat2) loc
               FROM vendor v,
                    vendaddr r,
                    letprop l,
                    planhold p,
                    proposal q,
                    project j,
                    propproj k,
                    bidlet bd
              WHERE v.vendor = r.vendor
                AND k.contid = q.contid
                AND k.pcn = j.pcn
                AND l.lcontid = k.contid
                AND p.vendor = v.vendor
                AND l.letting = p.letting
                AND TO_CHAR (bd.datelet, 'MM/DD/YYYY') IN P_LettingDate
                AND l.CALL = p.CALL
                AND r.addrnum = p.billto
                AND bd.letting = l.letting
           GROUP BY v.vendor,
                    r.addrnum,
                    v.vnamel,
                    r.aaddr1,
                    p.billto,
                    r.acity,
                    r.astate,
                    q.cdescr,
                    q.clocat1,
                    q.clocat2,
                    bd.letting,
                    r.azipcode,
                    r.vasst1,
                    r.aphone,
                    l.letting,
                    l.lcontid,
                    q.cprojnum;
    END PLANHOLDERSLIST;

    you can create your on array type and then pass that as the parameter. I use the suffix of ttyp to represent a table type.  The name of the column when using the table() syntax is columnvalue.
    I altered my session to set the default date format to match your format. you could have used the to_date function to set the values for the arr type.
    Hope this helps.
    create type msw_ttyp as table of date
    create or replace
    procedure msw_test(p_arr     in msw_ttyp) as
    v     integer;
    begin
    select count(*)
       into v
       from table(p_arr);
    dbms_output.put_line('count: '||v);
    for rec in (select column_value
                   from table(p_arr))
    loop
      dbms_output.put_line(rec.column_value);
    end loop;
    end msw_test;
    alter session set nls_date_format = 'MM/DD/YYYY';
    set serveroutput on size 1000000
    exec msw_test(msw_ttyp('01/17/2010', '01/27/2010','05/22/2010'));
    begin
    msw_test(msw_ttyp(to_date('01/17/2010', 'MM/DD/YYYY'),
                       to_date('01/27/2010', 'MM/DD/YYYY'),
                       to_date('05/22/2010', 'MM/DD/YYYY')));
    end;
    /

Maybe you are looking for

  • Encrypt custom attribute

    Tar: 7340338.994 OID Version: 10.1.2.0.2 We are trying to encrypt the custom attribute ( ssn, answer ). How do we encrypt the custom attribute ? This is security requirement. I find nothing in the admin guide and I am not even sure we can do this. Do

  • Mac and windows together on one computer

    is it true that you can use both Mac OS X tiger v10.4 and microsoft windows in one computer, and do i have to buy a certain computer. im looking at either macbook or macbook pro. does it work on those?

  • Mail stops importing after 500 messages. (From mbox formattedfile)

    Hi, using snow leopard, standard mail app. when importing a unix-style mbox file into mail, it stops after 500 messages. There are some 2700 mails in the mbox file. Any idea if this is a build-in limitation ? Can this be configured to allow more then

  • Macbook Pro has a siren noise when restarting

    When I restart my computer and as it starts to boot up, a loud interval siren noise starts and the computer has a blank black screen. The only way for me to stop it is to shut down my computer right away. Any suggestions on what this problem might be

  • ABAP Query - Sq03 0 infosets missing post upgrade to ECC 6.0

    Hi , After upgrading from 4.6C to ECC 6.0 we found that few infosets from SQ03 & also from SQ01 is missing in the upgrade box ECC 6.0. Can anyone help to troubleshooting it. Thanks & Regards Senthil