SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 2 of 2
  1. #1
    Member
    Join Date
    Aug 2006
    Posts
    88
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    how to use parameter in sql query

    Query1="select sum(AMOUNT_PAID) from customers where to_char(paid_date,'mm/dd/yyyy')='01/01/2014'"

    Now each time i run the query in QTP (all the DB connection and everything in place and works without issues) I want to pass the date as a input value from the QTP data table.
    Hence it would dtPaid_date=datatable.value("PAID_DATE",dtLocalshe et).

    Now when i said
    Query1="select sum (AMOUNT_PAID) from customers where to_char(paid_date,'mm/dd/yyyy')='&dtPaid_date'"

    QTP is not recognizing the parameter.

    Please advice.

  2. #2
    SQA Knight
    Join Date
    Jun 2008
    Posts
    2,555
    Post Thanks / Like
    Mentioned
    3 Post(s)
    Tagged
    1 Thread(s)
    Total Downloaded
    0
    You're missing the closing quotes and reopen in your string concatenation.
    Code:
    Query1="select sum (AMOUNT_PAID) from customers where to_char(paid_date,'mm/dd/yyyy')='" & dtPaid_date & "'"

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 11.54%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 10:19 AM.

Copyright BetaSoft Inc.