February 10, 2016 at 7:56 am
Hi
I am linking the results of an SQL query within MS Excel and I was wondering whether anyone knows how to convert an error message returned by SQL into a value that can be referenced in Excel.
In the example we need to check that database table names remain constant month on month so the query is set up to check that no changes have been made to the name and outputted as something that can be measured in Excel whether it is a text or number for example. But at the moment the error message Invalid object name just appears and does not populate anything within Excel.
Any help would be appreciated.
Thanks
February 10, 2016 at 9:28 am
Emma.Thackwray (2/10/2016)
HiI am linking the results of an SQL query within MS Excel and I was wondering whether anyone knows how to convert an error message returned by SQL into a value that can be referenced in Excel.
In the example we need to check that database table names remain constant month on month so the query is set up to check that no changes have been made to the name and outputted as something that can be measured in Excel whether it is a text or number for example. But at the moment the error message Invalid object name just appears and does not populate anything within Excel.
Any help would be appreciated.
Thanks
You can use TRY CATCH to trap the error, and ERROR_NUBER() (or one of the related functions) to check the kind of error.
https://msdn.microsoft.com/en-us/library/ms175976.aspx
https://msdn.microsoft.com/en-US/library/ms175069.aspx
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply