Quantcast
Channel: Quality Center / ALM Practitioners Forum topics
Viewing all articles
Browse latest Browse all 5491

Not able to pass long Select/SQL Statement via OTA

$
0
0

All,

 

I am trying to run SQL from within Excel using OTA but it is not pulling expected records.

 

When I test my code passing small query like "Select Top 5 * from Bug" it works. But when it comes to a long query like below it is not returning any records

 

PS: Code does not throw any error only shows 0 as count. I have tested the query against DB there are lots of records

 

Thanks!

 

----------

 

sSQL = "SELECT convert(datetime,CONVERT(VARCHAR,AU_TIME,101))AU_TIME, BG.BG_USER_10 as 'Status', BG.BG_PRIORITY as 'Priority', COUNT(*) as 'Count' " & _
   "FROM ( select AU_ENTITY_ID, MAX(AU_TIME) AU_TIME FROM td.AUDIT_LOG AG " & _
         "INNER JOIN td.AUDIT_PROPERTIES AP ON AP.AP_ACTION_ID = AG.AU_ACTION_ID " & _
            "WHERE  convert(datetime,CONVERT(VARCHAR,AU_TIME,101)) between " & _
                   "convert(datetime,CONVERT(VARCHAR,dateadd(dd,-6,GETDATE()),101)) and " & _
                   "convert(datetime,CONVERT(VARCHAR,GETDATE(),101)) " & _
                   "AND AP_FIELD_NAME ='BG_USER_10' " & _
            "GROUP BY AU_ENTITY_ID) RESULTS " & _
         "INNER JOIN td.BUG BG ON AU_ENTITY_ID= BG.BG_BUG_ID " & _
            "WHERE BG_PROJECT LIKE '%xxxx%' " & _
            "GROUP BY convert(datetime,CONVERT(VARCHAR,AU_TIME,101)), BG.BG_USER_10,BG.BG_PRIORITY " & _
   "ORDER BY convert(datetime,CONVERT(VARCHAR,AU_TIME,101)),BG.BG_USER_10 ASC"

Set oCommand = td.Command
oCommand.CommandText = sSQL
Set SQLResults = oCommand.Execute
MsgBox SQLResults.RecordCount


Viewing all articles
Browse latest Browse all 5491

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>