Cita:
Iniciado por Libras
Probé el primero:
Código SQL:
Ver originalBEGIN TRY
SELECT *
FROM sys.messages
WHERE message_id = 21;
END TRY
GO
-- The previous GO breaks the script into two batches,
-- generating syntax errors. The script runs if this GO
-- is removed.
BEGIN CATCH
SELECT ERROR_NUMBER() AS ErrorNumber;
END CATCH;
GO
Me tiró lo siguiente:
Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near 'TRY'.
Msg 156, Level 15, State 1, Line 5
Incorrect syntax near the keyword 'END'.
Msg 170, Level 15, State 1, Line 4
Line 4: Incorrect syntax near 'CATCH'.
Msg 195, Level 15, State 10, Line 5
'ERROR_NUMBER' is not a recognized function name.
¿Estos controles funcionan en sql server 2005? Porque la guía esta dice "sql server 2008"...