September 13, 2010 at 1:03 pm
Can someone say is it possible to change font or color in the output. My sql statement is print error_message(), so whenever it prints this i want it to be in different color or font. Please advice. thnaks
September 13, 2010 at 1:16 pm
if you are talking about the color of the results in the message panel in SSMS, the only thing you can change is the font size and font type; the colors being used for error messages is not exposed.
SSMS>>Tools>>Options
Environment>>Fonts and Colors
drop down menu for "Text Results"
only thing exposed is font type and size.
this affects the font for both results and error messages.
Lowell
September 13, 2010 at 1:28 pm
thanks, but i want the the message ONLY from "print error_message()" to be printed in different font. I am using this in a cursor inside try/catch block and i wouldn't know when an error occured since the entire result is in same font.
September 13, 2010 at 1:36 pm
nope, the font is not dynamically exposed either, even though a richtextbox is being used to display the data;
about the only thing you could do is use a try catch,and wrap it with thins like this to make it more obvious when reviewing a long file;
you could also simply use the search feature for "error" and find each item one by one.
--assuming inside your cursor
BEGIN TRY
Begin Transaction
<do something in cursor>
Commit transaction
END TRY
BEGIN CATCH
DECLARE
@ErrorSeverity INT,
@ErrorNumber INT,
@ErrorMessage NVARCHAR(4000),
@ErrorState INT
SET @ErrorSeverity = ERROR_SEVERITY()
SET @ErrorNumber = ERROR_NUMBER()
SET @ErrorMessage = ERROR_MESSAGE()
SET @ErrorState = ERROR_STATE()
PRINT '--################### ERROR BEGINS ##################'
PRINT @ErrorMessage
PRINT '--################### ERROR ENDS ####################'
END CATCH
Lowell
September 13, 2010 at 4:17 pm
that's what i exactly did, just wanted to see if there is a better way. Thanks
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply