It is possible to change the default font colour (color) used in SQL Server Management Studio (SSMS) in the messages pane output, via a SQL print command?
IF @@TRANCOUNT>0 BEGIN
PRINT 'The database update succeeded'
COMMIT TRANSACTION
END
ELSE PRINT 'The database update failed'
GO
I.e
To change font color, size, and style in the EditorClick Options on the Tools menu. Click Environment, and then click Fonts and Colors. In the Show settings for list, select Text Editor. Change the font, size, display item, foreground and background colors.
The font must be a True Type fixed pitch font such as Courier New or Lucida Console. Enter the font size you want to use in pixels, such as 14, in the Value Data: field. SQL*Plus will use the new font size the next time you start the SQL*Plus Windows GUI.
SQL Server Management Studio (SSMS) let you customize text properties as you like. Open SSMS, Go to Tools and then Options as shown below. Go to Environment and then click on Fonts and Colors. Under options you can make changes as you like.
It's a bit of an old post, but if you still want to be able to display your text in red: use the built in RAISERROR function. You can set the severity of the error and that will determine if it outputs your text in black or red. For example:
raiserror('Your error message', 10, 0)
Will display the error with just the black font color
raiserror('Your error message', 11, 0)
Will display the error with a red font color
Message severity of 10 or lower will use black font color, 11 or higher will use red font color.
For completion: message severity of 20 or higher will stop executing the rest of the script, and if you use a message severity of 19 or higher you have to call the raiserror function with the log option, like so:
raiserror('Your error message', 20, 0) with log
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With