Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2012
    Posts
    27

    Unanswered: When passing two parameters???

    What is the equivalent to this simple select statement in DB2?

    SELECT * FROM Table1 WHERE field1 = @param1 AND field2 = @param2

    I don't think two '?' will do it...

  2. #2
    Join Date
    Apr 2006
    Location
    Belgium
    Posts
    2,514
    Provided Answers: 11
    this is a valid statement in an application (?)
    it could also contain parameter markers as
    SELECT * FROM Table1 WHERE field1 = ? AND field2 = ?
    or literals..
    Best Regards, Guy Przytula
    Database Software Consultant
    Good DBAs are not formed in a week or a month. They are created little by little, day by day. Protracted and patient effort is needed to develop good DBAs.
    Spoon feeding : To treat (another) in a way that discourages independent thought or action, as by overindulgence.
    DB2 UDB LUW Certified V7-V8-V9-V9.7-V10.1-V10.5 DB Admin - Advanced DBA -Dprop..
    Information Server Datastage Certified
    http://www.infocura.be

  3. #3
    Join Date
    Mar 2012
    Posts
    27
    Thanks PRZYTULA GUY for responding back, but how can the (?) know which value of parameter is being pass?

    For an example, I created a web form using vb.net with a db2 database. I had to import the IBM.Data.DB2.iSeries classes to use some of the .Net functionality with DB2.

    When I pass two parameters in the following code:

    Public function Test(ByVal param1 As String, ByVal param2 As String)

    ........
    ........

    SELECT * FROM Table1 WHERE field1 = @param1 AND field2 = @param2
    The parameters are unique by name, but how would two '?' know which parameter is being pass?


    Do you see where I am confused?

  4. #4
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    Check the samples in the manual, e.g. this: Call different types of stored procedures from SpServer.vb
    ---
    "It does not work" is not a valid problem statement.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •