Micro Focus QTP (UFT) Forums
Getting ODBC error while executing the sql query in excel(DB) - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Getting ODBC error while executing the sql query in excel(DB) (/Thread-Getting-ODBC-error-while-executing-the-sql-query-in-excel-DB)



Getting ODBC error while executing the sql query in excel(DB) - Shkumari - 05-04-2013

Hi All,

I am new to this forum and even in Automation field also.Actually my problem is: In my application i am doing export to excel and then considering the excel as db and running the sql statment like below:
select disctint(count empid) from <filename>
but getting error as ODBC

But when i am execting select * from <filename> where empid=10 then it is getting executed.
-2147418113 catastrophic failue error getting Sad
i am not sure what is issue.So could you please suggest any tips for this


RE: Getting ODBC error while executing the sql query in excel(DB) - Saket - 05-06-2013

disctint should be DISTINCT in "select disctint(count empid) from <filename>"


RE: Getting ODBC error while executing the sql query in excel(DB) - Shkumari - 05-07-2013

Its Typeo Error Smile I did the same things but still issue persist.Please let me know any solution for it.

Actually if i am doing select * from <filename>emp....its working fine.I am not why the above query is not working.


RE: Getting ODBC error while executing the sql query in excel(DB) - Shkumari - 05-10-2013

Hi All

Can We use all SQL commands in CSV file(considering CSV as a database)?

And also if we exported our data in CSV and then considering it like database.I want to get the non-repeatable records from CSV.How can i do this.Please suggest me asap


RE: Getting ODBC error while executing the sql query in excel(DB) - Saket - 05-10-2013

What exactly you are trying to achieve? as far as I can understand you want the count of all distinct empid in a sheet. Very sorry I did not notice earlier. the correct query would be
Select Count( Distinct <columnname>) from <Sheet>

but I doubt this will work in excel as Count(Distinct) does not work with Access, it only works with Oracle and SQL

For you question Can We use all SQL commands in CSV file(considering CSV as a database)?
I have not tried it yet, but seems not feasible. CSV file can be treated as flat file and I dont think we can query to that.


RE: Getting ODBC error while executing the sql query in excel(DB) - Shkumari - 05-10-2013

Thanks a lot...But could you please suggest me the automation script to remove the duplicates from the CSV.As i need to do comparsion between count visible in application and CSV counts.It should match...Because of this i am removing the duplicate and then take the count.

Please let me know asap as it is very urgent for me.

Thanks in Advance