Passing Variables to a SQL Query

I have a select box with multiple choices allowed in
form1.ASP. I want =
to pass the form on submit using request.form ("variable")
and process =
data and a query string for an SQL select where statement.
The form =
data is in the format of "E123 B456 X789" . What is the best
means of =
processing that for my Access database?
Thanks.
Ross

Well, here's the answer:
http://kb.adobe.com/selfservice/viewContent.do?externalId=3Dtn_15906&slic=
eId=3D1
"ross m. greenberg" <[email protected]> wrote in
message =
news:gb5reg$714$[email protected]..
I have a select box with multiple choices allowed in
form1.ASP. I want =
to pass the form on submit using request.form ("variable")
and process =
data and a query string for an SQL select where statement.
The form =
data is in the format of "E123 B456 X789" . What is the best
means of =
processing that for my Access database?
Thanks.
Ross

Similar Messages

  • How to pass variable into lov sql query using like operator

    hi.
    i want to use a lov where i want to pass a variable using like operator.
    my query is
    select empno,name from table where empno like ':ed%';
    my empno is A001 TO A199 AND B001 TO B199 so i want show either A% or B% empno
    how can i do this ?
    reagrds

    kindly press Shift+F1 at a time you face this error to see the exact Oracle error message.
    and provide us with that detail
    and its better if you start new topic for that error... because that will be new error,,,
    -- Aamir Arif
    Edited by: Aamiz on Apr 7, 2010 12:27 PM

  • Passing parameter to a SQL query - Please help

    Hi All,
    I am new to JDBC. I have been trying to pass an external variable to an SQL Query.
    The query is
    String username1="le";
    PreparedStatement pstmt = null;
    pstmt = c.prepareStatement("select * from users where USER_NAME like '%?%'");
         pstmt.setString(1, username1);
         pstmt.executeQuery();
         ResultSet rs = pstmt.getResultSet();
    I am trying to retrieve values from the users table where the USER_NAME column value that is a String contains the supplied value username1.
    I am using the question mark (?) character to pass the value from the variable username1. I am also using the '%' substitution character which matches for any number of characters. So, the above query should retrieve rows where the USER_NAME is something like "charles","leander","Elena" etc.( that contains "le")
    I am getting the error:
    SQLException: java.sql.SQLException: ORA-01006: bind variable does not exist
    I changed the query to
    PreparedStatement pstmt = null;
    pstmt = c.prepareStatement("select * from users where USER_NAME like '% " + username1 + "%'");
         //pstmt.setString(1, username1);
         pstmt.executeQuery();
    This time , it is not giving the error and retrieving properly.
    But I want to use the original query and use the "pstmt.setString(1, username1); " . Is there any way of achieving this?
    Please help.
    Cheers,
    charles_am

    hi,
    try this...
    String username1="%le%";
    pstmt = c.prepareStatement("select * from users where USER_NAME like ?")
    pstmt.setString(1,username1);
    cheers,
    rpk

  • How to pass a variable for a SQL query in OLEDB source?

    Hi All,
    I am new to SSIS and working on it past few days. Can anyone please help me getting through a scenario where I need to pass a variable in the SQL statement in OLEDB source connection. Please find below for the details.
    eg:
    1) I have a SQL table with the columns SerialNumber, Name, IsValid, FileName with multiple rows.
    2) I have the file Name in a variable called Variable1.
    3) I want to read the data from my SQL table filtering based on the FileName (Variable1) within a data flow task and pull that data to the destination table.
    Question: In the data flow task, added source and destination DB connection with a script component in between to perform my validations. When trying to retrieve the data from source using the variable (i.e. SQL Query with variable), I am not able to add
    the query as the SQL statement box is disabled. How to filter the data based on the variable in the source DB ?
    Any help/suggestions would be of great help.
    Thanks,
    Sri

    Just to add with Vaibhav comment .
    SQL Command  : SQL query either with SQL variable or any condition  or simple Sql statement
    Like ;
    Select * from dimcustomer
    SQL Command using Varible :
    Sometimes we design our dynamic query in variable and directly use that variable name in oledb source.
    If you Sql query needs a condition based on SSIS variable .
    you can find a Example here :
    http://www.toadworld.com/platforms/sql-server/b/weblog/archive/2013/01/17/ssis-replace-dynamic-sql-with-variables.aspx
    http://www.select-sql.com/mssql/how-to-use-a-variable-inside-sql-in-ssis-data-flow-tasks.html
    Thanks
    Please Mark This As Answer or vote for Helpful Post if this helps you to solve your question/problem. http://techequation.com

  • How to pass a result of SQL query to shell script variable

    Hi all,
    I am trying to pass the result of a simple SQL query that only returns a single row into the shell script variable ( This particular SQL is being executed from inside the same shell script).
    I want to use this value of the variable again in the same shell scirpt by opening another SQL plus session.
    I just want to have some values before hand so that I dont have to do multiple joins in the actual SQL to process data.

    Here an example :
    SQL> select empno,ename,deptno from emp;
         EMPNO ENAME          DEPTNO
          7369 SMITH              20
          7499 ALLEN              30
          7521 WARD               30
          7566 JONES              20
          7654 MARTIN             30
          7698 BLAKE              30
          7782 CLARK              10
          7788 SCOTT              20
          7839 KING               10
          7844 TURNER             30
          7876 ADAMS              20
          7900 JAMES              30
          7902 FORD               20
          7934 MILLER             10
    14 rows selected.
    SQL> select * from dept;
        DEPTNO DNAME          LOC
            10 ACCOUNTING     NEW YORK
            20 RESEARCH       DALLAS
            30 SALES          CHICAGO
            40 OPERATIONS     BOSTON
    SQL> exit
    Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
    With the Partitioning, OLAP and Data Mining options
    $ cat my_shell.sh
    ### First query #####
    ENAME_DEPTNO=`sqlplus -s scott/tiger << EOF
    set pages 0
    select ename,deptno from emp where empno=$1;
    exit
    EOF`
    ENAME=`echo $ENAME_DEPTNO | awk '{print $1}'`
    DEPTNO=`echo $ENAME_DEPTNO | awk '{print $2}'`
    echo "Ename         = "$ENAME
    echo "Dept          = "$DEPTNO
    ### Second query #####
    DNAME_LOC=`sqlplus -s scott/tiger << EOF
    set pages 0
    select dname,loc from dept where deptno=$DEPTNO;
    exit
    EOF`
    DNAME=`echo $DNAME_LOC | awk '{print $1}'`
    LOC=`echo $DNAME_LOC | awk '{print $2}'`
    echo "Dept Name     = "$DNAME
    echo "Dept Location = "$LOC
    $ ./my_shell.sh 7902
    Ename         = FORD
    Dept          = 20
    Dept Name     = RESEARCH
    Dept Location = DALLAS
    $                                                                           

  • Using System Variables in a SQL Query

    Hi!
    I´m new to Oracle and SQL so i don´t know very much about it.
    There is miy Problem:
    Is there a way to Use the System Variable %USERNAME% in an SQL Query?
    I tried .... where table.shorttag = '%USERNAME%' ;
    but this doesnt work.
    Is Oracle able to handle Systemvariables? Or is there another way to use the current Windows User in an SQL Query.
    It is very Important to use the current Windows user and not the Oracle user.
    Thank you,
    Mfg

    Are you looking for something like this ?
    SQL> SELECT sys_context('USERENV', 'OS_USER') FROM dual;
    SYS_CONTEXT('USERENV','OS_USER
    SAUBBANE\IBM
    SQL> SELECT sys_context('USERENV', 'TERMINAL') FROM dual;
    SYS_CONTEXT('USERENV','TERMINA
    SAUBBANEAlso you can look at the dbms_application_info package.

  • Passing variables to a SQL script within GC

    Does anyone know if it is possible to pass in a variable to a SQL script job within Grid Control? I don't see that I can but I wanted to ask a larger group before cloing the loop on this.
    For example, I have a few different databases which contain schemas which contain date-range daily partitioned tables. I have a single code block which normally accepts the table_owner as a variable then loops through to analyze the current day partition. I'd love for OEM to be able to have the job submitted to different database targets whilst passing in a different schema name.
    Thank you in advance!

    This can be done in two steps, but first create a table containing 1 field in all the target databases (something like table_owner) you want to analyze. Before running the analyze script change in all the to be analyzed databases the table_owner (as a job?). Then run the analyze script that contains a statement that first reads the table_owner and use this table_owner as the variable you want.
    Even more simple would be to use a database link from the to be analyzed db's to a central db so you only have to change the table_owner in one table.
    Eric

  • Pass Variables into AS3 through Query String?

    Man! I've been searching ferociously and can't seem to find a solution that works for me. I am trying to pass variables via query string on a PHP page to Flash, and then have the swf add movie clips to the stage depending on the information it receives.
    Here is what the PHP outputs:
    swfobject.embedSWF("flash/detailScore.swf?a=0-0&b=0-0&c=30-54&d=30-20&e=42-18", ...
    And here is my AS3 code:
    function loaderInfoSh(e:Event):void{
    var myQueryStrings=this.loaderInfo.parameters;
    a = myQueryStrings.a;
    b = myQueryStrings.b;
      c = myQueryStrings.c;
    d = myQueryStrings.d;
    e = myQueryStrings.e;
    addTheResults(a,1);
    addTheResults(b,2);
    addTheResults(c,3);
    addTheResults(d,4);
    addTheResults(e,5);
    this.loaderInfo.addEventListener(Event.COMPLETE, loaderInfoSh);
    The addTheResults function takes the coordinates, adds a MC instance to the stage and positions it accordingly.
    var colorMCArray:Array = new Array();
    function addTheResults(val,colnum:Number){
    if(val == null){val = "52-46";} // so I can test it locally
    var daColor:String;
    switch (colnum){
    case 1:
    daColor = "f3951c";
    break;
    case 2:
    daColor = "74b47d";
    break;
    case 3:
    daColor = "436494";
    break;
    case 4:
    daColor = "9b74ac";
    break;
    case 5:
    daColor = "b43d44";
    break;
    var dash:int = val.indexOf("-");
    var lateral = val.slice(0,dash);
    var vertical = val.slice(dash+1);
    lateral --;
    vertical --;
    // adding the MC instance
    var comm:tileB = new tileB();
    comm.name = "comm"+colnum;
    addChild(comm);
    colorMCArray[colnum] = comm;
    //Change the color
    var colorTransform:ColorTransform = colorMCArray[colnum].transform.colorTransform;
    var thiscolor = "0x"+daColor;
    colorTransform.color = thiscolor;
    colorMCArray[colnum].transform.colorTransform = colorTransform;
    colorMCArray[colnum].x = 5;
    colorMCArray[colnum].y = 536;
    colorMCArray[colnum].x += (lateral * 9);
    colorMCArray[colnum].y += (vertical * 9)*-1;
    colorMCArray[colnum].addEventListener(MouseEvent.MOUSE_OVER, btnro);
    colorMCArray[colnum].addEventListener(MouseEvent.MOUSE_OUT, btnrout);
    I don't know what I'm doing wrong here.

    Was this the "e" in the code below you were pertaining to as the culprit? "e" is not a keyword. It's just the shortcut for the word "event" for the variable name of type Event which is the Event object that triggered the call of function loaderInfoSh. In your code you assigned e = myQueryString.e which should have given you a type mismatch error.
    function loaderInfoSh(e:Event):void{
    var myQueryStrings=this.loaderInfo.parameters;
    a = myQueryStrings.a;
    b = myQueryStrings.b;
      c = myQueryStrings.c;
    d = myQueryStrings.d;
    e = myQueryStrings.e;
    addTheResults(a,1);
    addTheResults(b,2);
    addTheResults(c,3);
    addTheResults(d,4);
    addTheResults(e,5);
    this.loaderInfo.addEventListener(Event.COMPLETE, loaderInfoSh);

  • How to pass two parameters to sql query

    I try to create a sql script to update two columns in one table. I want to set it as parameter. When people execute this sql script, they need to pass parameter into sql query, then query will be executed successfully. The problem is I am only able to pass one parameter. If set two parameters in one line code, it will get ORA-00933 errors. Please advice me where I was wrong. The code is simple and like this:
    update MY_TABLE set year = &year AND month = &month where application_type = 'xxxx';
    If I only have: update MY_TABLE set year = &year where application_type = 'xxxx'; It works. If I set two parameters to pass value. It will get error.

    Hi,
    When you UPDATE two or more columns in the same statement, use ',' instead of 'AND' to separate them:
    update  MY_TABLE
    set     year = &year
    ,       month = &month
    where   application_type = 'xxxx';The correct syntax for all SQL statements, including UPDATE, can be found in the [SQL Language manual|http://download.oracle.com/docs/cd/B28359_01/server.111/b28286/statements_10008.htm#sthref9598].

  • Pass variable into execute sql task

    hi
    i want to execute my stored proc, in ssis package . i have 2 parameter, so i need pass values from another table one by one.
    i need to execute stored proc for each from another table, by passing values
    how to do it

    hi
    i want to execute my stored proc, in ssis package . i have 2 parameter, so i need pass values from another table one by one.
    i need to execute stored proc for each from another table, by passing values
    how to do it
    You can do it as follows
    1. Add a variable of type object in SSIS
    2. Add a execute sql task with query as
    SELECT field1,field2
    FROM Table
    Set resultset option as Full resultset and in resultset tab map the resultset to object variable.
    3. Add a ForEach loop with ADO enumerator and map it to object variable. Inside loop add two variable to get each iterative values for field1 and field2
    4. Inside loop add a execute sql task and set command as
    EXEC ProcedureName ?,?
    Map the parameters to two variables created inside the loop.
    On executing package the procedure gets executed for each record in the table.
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Passing multiple parameters in sql query

    Hi All,
    This may not be the correct place to post this.
    How to pass multiple paramters to a variable in sql developer.
    Ex: Select * from Country where state= :statename (Country is table name, state is column name)
    If I execute the above query in SQL Developer I can pass only one parameter at a time for :statename ie either KERALA,KARNATAKA,PUNJAB etc.
    How can I pass multiple values (all KERALA,KARNATAKA,PUNJAB) or ALL column values at a time in SQL Developer.
    Thanks

    user1668671 wrote:
    How to pass multiple paramters to a variable in sql developer.A scalar variable by definition cannot store more than one value at a time.
    Array type variables can, as this example using the built in type odcivarchar2list shows
    SQL> select
      2      object_name,
      3      object_type
      4  from
      5      all_objects o
      6  where
      7      o.object_name in
      8      (select column_value from
      9      table(sys.odcivarchar2list('DUAL','ALL_OBJECTS')));
    OBJECT_NAME                    OBJECT_TYPE
    DUAL                           TABLE
    DUAL                           SYNONYM
    ALL_OBJECTS                    VIEW
    ALL_OBJECTS                    SYNONYM
    ALL_OBJECTS                    VIEWHere is a full discussion with multiple solutions for various versions including a string parsing
    http://tkyte.blogspot.com/2006/06/varying-in-lists.html
    Does SQL Developer support array type variable? I don't know they may know here {forum:id=260}
    Otherwise the link above shows how to parse a single character variable into multiple values that will be needed.

  • How to pass variable to jump to query !

    hello Experts !
    i have a query with variable "Month". so when i run that , user enters the Month/year and it gives the results for "Employee ID" for that month/year.
    i have also creted another query on dso, in order to get detail line item information abt " Employee ID" and join this query with the main one thru RRI.
    in RRI , i have selected "Employee ID" as single value field for both the query. the problem is when i do GOTO from the first query , it does work and gives me the result, but it gives records corresponds to that "Employee id"for all the months and year.
    How do i also pass "Month" - variable value along with that "Employee id" so that the second query only shows line item for that employee id for that selected month.
    thanx

    Hi,
    The use of jump query is to get the detailed level information, for the key figure values which appears in main query.
    This mainly happen when in your cube design you do not details information.
    For example:
    In your main query output you have :
    division , company code , variable amount
    Rec1)10, 1012,4000
    Rec2)20,1001,5000
    Now you want to know what are the document numbers involved to get the variable amount:
    So now , you jump query output will be for record no 1.
    Document number , variable amount
    100001,500
    100002,1000
    100003,2000
    100004,500
    So now you can see that jump query is giving you the documents numbers which are total of 4000.
    Once you have variable in main query , the jump will give details of those keyfigur values only.
    In case of jump query you need not to have any variable , it will automatically take from parant query.
    Though you can define varaible for jump also.
    I hope it clear your doubt
    Thanks
    Mayank

  • Passing variables to a BEx query dynamically

    Hi All,
    We have a requirement to pass values for variables dynamically to a Bex 7x query because we do not want to prompt any variable screen to the user. I tried few steps as suggested in SAPBEXsetVariables range but still have some questions unanswered. So request your thoughts on the same.
    Below procedure has been followed.
    1. Open Bex Analyzer
    2. Navigate to Bex Analyzer (menu) -> Design Toolbar -> Insert Button. This will switch on the Design Mode.
    3. Click on the button, select "Workbook-Specific Command" and click on next (Data provider need not be worried about at this point as it can be changed later also).
    4. Select "Process Variables" and click on Finish.
    5. One more window with an heading "Properties of Button" will be shown with fields like "Name of Button", "Range", "Button Text", "Command Range" and few other.
    6. On the right side of this window, list of Static Parameters can be created.
    7. As an example, i created below parameters
    CMD                         0          PROCESS_VARIABLES
    DATA_PROVIDER      0          DP_1
    and created a range having below details and provided this range in "Command Range" field (in button properties)
    VAR_NAME                     0         #NAME1#              
    VAR_VALUE_EXT            0          #VALUE#
    VAR_NAME_1                 0          #NAME2#
    VAR_VALUE_EXT_1         0          #VALUE2#
    8. This DID NOT WORK for me. Actually nothing was happening when the button was pressed.
    After some investigation, i figured out that i need to have one command like below
    CMD          
              1     
    SHOW_VARIABLE_SCREEN
    Without this neither the variable screen was shown nor it read the parameter values from the excel range provided.
    Once this was done, the input screen was shown and with the values that i provided in my excel range.
    Here are my questions. Pls provide your valuable inputs.
    1. Why am i forced to have a command for "SHOW_VARIABLE_SCREEN"? Is this mandatory? problem with this is that user will always be shown a input screen which we don't want (in fact the very reason for this exercise is not to show the parameter screen but to supply values to it from the back end). Is there some setting that i need to do to get rid of this?
    2. The setup can read values for only  2 parameters. i mean when there is an additional variable, the program is not reading the 3rd parameter values (of course i updated the "command range").
    VAR_NAME                     0         #NAME1#              
    VAR_VALUE_EXT            0          #VALUE#
    VAR_NAME_1                 0          #NAME2#
    VAR_VALUE_EXT_1         0          #VALUE2#
    VAR_NAME_2                 0          #NAME3#
    VAR_VALUE_EXT_2         0          #VALUE3#
    Thank you. Looking for a sooner response.
    Lohith

    Hi All,
    I figured out the mistake that i have done. Looks like the order of the commands is very important.
    In my case, i had something like below
    CMD                         0          PROCESS_VARIABLES
    DATA_PROVIDER      0          DP_1
    SUBCMD                   0          VAR_SUBMIT
    I should not have the PROCESS_VARIABLES as my first command. Instead should have DP_1 or the SUBCMD as first argument. So below order worked for me.
    DATA_PROVIDER      0          DP_1
    SUBCMD                   0          VAR_SUBMIT
    CMD                         0          PROCESS_VARIABLES
    So, i don't need to have "SHOW_VARIABLE_SCREEN" command as i don't want to show the screen.
    But my second question is still unanswered. Can you through some light on it?
    2. The setup can read values for only  2 parameters. i mean when there is an additional variable, the program is not reading the 3rd parameter values (of course i updated the "command range").
    VAR_NAME                     0         #NAME1#              
    VAR_VALUE_EXT            0          #VALUE#
    VAR_NAME_1                 0          #NAME2#
    VAR_VALUE_EXT_1         0          #VALUE2#
    VAR_NAME_2                 0          #NAME3#
    VAR_VALUE_EXT_2         0          #VALUE3#
    Lohith

  • BICS - Passing variables to a BEx Query

    Hi Experts,
    We are currently developing dasboards in Dashboard Design (XCelsius) using BICS. Since we want to leverage the 'create once, reuse many times' principle, we would like to populate our (data intensive) dashboard using 8 connections that fill out different values in one and the same BEx Query. The results (8 crosstabs) will be put in our embedded sheet on 4 different tabs.
    All data has to be refreshed before components are loaded (so this option is set for all connections).
    Furthermore, we set the 8 connections with the following parameters:
    [definiton tab].[input values].[variables].[BEx variable] > link to a cell containing tech name of input value
    [definition tab].[input values].[filters].[key figures] > link to a cell containing the tech name of the key figure we want to display in the crosstabs.
    Now, we are facing 2 problems:
    1. The variables are not automatically passed to the BEx query (we see a BEx web variable input screen on launch)
    2. The key figures are not filtered (we did set the tech key i.e. 8KPM8AAGH55L3ONGZC0Y27FBG)
    Does anyone have similar experiences, using BICS and (ideally) found a solution yet? I'd like to avoid creating 8 different BEx queries to solve this. Thank you in advance!
    KR, Bart Santing

    Hi,
    You have to map the excel cell to the exact keyfigure or vriable.
    For example.
    I have two filters in my BEx Query. Calendar Year & Country
    For mapping these filters expand the ==>Filters in Data Manager of xCelsius. Then you can see Calendar Year and Country. Map Calendar Year to an excel cell as well as map the country to another excel cell.
    Do this same for variable also.
    Thanks,
    Ajish George

  • Pass Multiple Parameters to SQL query in Drop down or Select Boxes

    Post Author: JasonW
    CA Forum: Data Connectivity and SQL
    Hello all- I am using CR XI and SQL server 2000.I have written a SQL statement and used that statement as a 'command' in the Database Expert, to pull data into a report.  There are two issues I have that I need some help/advice on.-. The report needs 4 parameters.  A, B, C, D.-. I can create Parameters in the Database Expert that will prompt me for the data when I refresh the report. However,-. I need to be able to select those parameters in drop down boxes based on data in the SQL database.  The problem is that the parameter cannot pull the data without the criteria - so a drop down box seems impossible.  OR is it?  That is part of my question.  The other part is - Even if it is possible, can Crystal do this somehow?  NOTE: The query is selecting the data rather than Crystal - so Creating a Parameter field IN the report is futile. -. The other half of this problem is that users would like the ability to select multiple values from Field A and from Field B.  

    Post Author: JasonW
    CA Forum: Data Connectivity and SQL
    I ended up using a stored procedure.  This queries the proper data, and allows me to use Dynamic Parameters to make multiple selections on the data.  (I query out a large portion of the data in the stored procedure, then pair it down using Dynamic Parameters in Crystal.) Here is the new problem this has created:My Dynamic Parameters are not pulling all the values from the query.  Ex.  One field in the query is a "directory" listing.  It has 227 unique values in it.  (It has multiple values, it is not constrained.)  When I create a Dynamic Parameter off of this field, I only get 18 of the 227 as available selections in the drop down box.  However, I can type in any of the 227 values into the field manually, I pull the proper data.  So the data is there, its just not showing up in the drop down box.   Anyone have any ideas on this?

Maybe you are looking for

  • Cs5.5 master collection wont install After Effects or Premier

    Just upgraded from CS4 to CS5.5 and installation errors on After effects and Premier. I'm running windows 7 64 bit pro service pack 1,Duel x5650 xeons,  24 gigs of memory, 250 gb ssd. Before installing CS5 I uninstalled cs4. After the first installat

  • Print out of Purchase order.

    Hello all, We have release strategy for purchase order. Once the Po gets released, buyer takes out the print of purchase order. Head of dept & MD does manually signature on hard copy of purchase order.Now my clients wants that insted of doing manuall

  • Simple PRC file transfer between devices or via PC not so simple, sigh.

    Greeting, this is my first post so excuse me if I make some faux pas. I was unpleasantly surprised how difficult, almost imposible it is to take a [custom] PRC off one Palm device and put it on a second, even using a Windows PC as the intermediary. T

  • How to authenticate LDAP with account name?

    Hi, In my ADS server for all the users common name and account name are differently assigned , In LADP application which is developed using JNDI APIs it is able to authenticate the users with display name/ CN value(common Name ) only, but I need to a

  • Translating Excel query into flat file(.CSV)

    Hi, I have a requirement where i need the Excel Queries to be displayed in Flat file(.CSV) format. To be more clear i have an excel query but  my client requires this query to be displayed in a Flat file format. Can someone explain me how i can achei