Forum Discussion

Adagio's avatar
Adagio
Frequent Contributor
7 years ago
Solved

Big SQL queries and passing Variables in the SQL queries

Hello, I'm trying to execute some big SQL queries in TestComplete to fetch the data for the scripts. I'm able to execute small and simple queries, but when it comes to execute a query which has more ...
  • NisHera's avatar
    7 years ago

    if one line works but not two lines....I guess the problem is in concatenating .

    The query sending to  SQL should a single string. 

     

    to concatenate string in java script you can use + sign for more read this 

     

    first create string like....

    str1 = "select distinnct...." ;
    str1 = str1+"where ..blah blah" ;
    str1 = str1+"AND..blah blah" ;
    str1 = str1+"order by ..blah blah" ;

    and then send to your object

    var set conn.Execute(str1)

     special characters doesn't matter  as far as they are in side of string 

  • Adagio's avatar
    Adagio
    7 years ago

    Thank you, NisHera

     

    I got it working. I didn't have to split it did it in a similar fashion but without creating the string variable.

     

    here's the working code: 

     

     

    Thank you

    Abhi