I am looking to output a message from a function in MS SQL 2005 when executed from the sql server management studio, similar to Postgres' RAISE NOTICE.
+1
A:
You can raise errors with RAISERROR, or print messages with PRINT. You should look these up in Books Online.
treaschf
2010-02-09 12:28:14
+1
A:
To add to the other answers, you may want to read through these great articles:
Frank Kalis
2010-02-09 14:21:55
A:
The direct translation may be RAISERROR, but SQL Server 2005 now supports TRY/CATCH blocks
BEGIN TRY
BEGIN TRANSACTION TestTransaction
INSERT INTO tbBlah
(
SomeColumn
)
VALUES
(
5
)
COMMIT TRANSACTION TestTransaction
END TRY
BEGIN CATCH
ROLLBACK TRANSACTION TestTransaction
END CATCH
Peder Rice
2010-02-09 14:28:37