Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SELECT IN A TRY/CATCH ?

Status
Not open for further replies.

ice789911

Programmer
Mar 17, 2008
10
GB
Is it best practice to put a select statement inside a try catch block

Code:
BEGIN TRY
SELECT * from someTable
END TRY

BEGIN CATCH
--do something like log the error
END CATCH
 
On balance I think it is best to use a try/catch block because you should know if errors are randomly generated and this provides you with a means to log those errors
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top