我正在使用SQL Server 2008。我尝试执行以下操作:
BEGIN TRY
SELECT 1/0;
END TRY
BEGIN CATCH
PRINT 'ERROR'
END CATCH;
但是我遇到了以下错误:
>Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near 'TRY'.
Msg 156, Level 15, State 1, Line 3
Incorrect syntax near the keyword 'END'.
有人能告诉我如何在SQL Server中执行try catch吗?