| || |
Execution of SQL query through QTP where table name starts with #
I have connected SQL DB with QTP.
I am able to execute all the queries except the following
"select * from #temp_emp"
Mannually this query is getting executed correctly , however when tring to execute it through QTP i am getting error
"Invalid Object "#temp_emp" "
I guess this is cause of the table name starts with special character #
I have tried to surpass the speacial charater by adding / \ # before the character, but still not able to find the solution.
Please let me know if anyone has faced the same issue before and has any solution for it.
Thanks in advance.
Have you tried "Select * From " & Chr(35) & "temp_emp"?
Jonathan, that will not make a difference. The string generated will be the same and hence the query will fail. The issue seems to be how to query a table with special character in it. You can try below and see if it helps
"Select * from `#temp_emp`"
Thanks for early response , however I have already tried it, makes no difference.
Error "Invalid object "#temp_emp"
Hi Tarun , Thanks for the response.
I had tried with single quote also tried the below reply ..however showing syntax error.
Originally Posted by tarunlalwani
Where are you executing this code manually? This is a local temp table & you might be trying to access it from another session & that might be the reason for failure.
Originally Posted by pravink
Refer 'Temporary Tables' in this article.