Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
parameterized SQL query in QTP
#1
Solved: 10 Years, 9 Months ago
I ve got a problem

as soon as i create a record in my GUI an 2 unique ids are generated for a record and it is displayed at the bottom of my screen

I retreived the values using text output values

Now i need to validate whether the record is present in the database

I stored the 2 ids in the variables x & y respectively

in the Database output value I mentioned the sqlquery as

select * from table where id1='x' and id2='y'
I used the select SQL statement manually after setting up the connection string
The database ouput value Wizard throws an error.

Kindly help me out in this

how do i use output values as input to SQL
Reply
#2
Solved: 10 Years, 9 Months ago
Try this

select * from table where id1='"&x&"' and id2='"&y&"'
Reply
#3
Solved: 10 Years, 9 Months ago
Hi Jack

I did try this

I get an error stating that SQL query cannot be excecuted

details :[Microsoft][ODBC driver for Oracle][Oracle]ORA-01722: invalid number
Reply
#4
Solved: 10 Years, 9 Months ago
Hey guys

can someone help me out on this
Reply
#5
Solved: 10 Years, 9 Months ago
I guess the field Id1 and Id2 is expecting a numeric value
have you tried removing the single quote (')?
Code:
select * from table where id1="& x & " and id2=" & y

Reply
#6
Solved: 10 Years, 9 Months ago
I HAVE DONE IT BUDDY. I will try once again and get back to u
Reply
#7
Solved: 10 Years, 9 Months ago
it says "invalid identifier" now for this query

select * from table where id1="& x & " and id2=" & y"

tried all possible combinations . no sloution yet
Reply
#8
Solved: 10 Years, 9 Months ago
Hi,
Check, the id1 and id2 column's data type. According to it, you reframe your query and then try.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Exe invoked through UFT is unable to access IIS and SQL Server service bkdevise 0 1,973 08-25-2015, 05:49 PM
Last Post: bkdevise
  Query regarding "Call" statement anupam4j 1 1,909 09-26-2014, 01:46 PM
Last Post: vinod123
  parameterize Excel Sheet Name in SQL bjitsidhu 0 2,736 07-20-2014, 08:34 AM
Last Post: bjitsidhu
  Is there a possible way to execute sql in QTP using 'WITH' clause shruthic 0 2,987 04-26-2014, 11:42 PM
Last Post: shruthic
  Data Table Query Suma Parimal 4 4,473 01-21-2014, 12:50 PM
Last Post: Suma Parimal

Forum Jump:


Users browsing this thread: 1 Guest(s)