The current documentation for FORMATMESSAGE at http://msdn.microsoft.com/en-us/library/ms186788.aspx contains the following example:
DECLARE @var1 VARCHAR(100)
SELECT @var1 = FORMATMESSAGE(50001, 'Table1', 5)
I believe this to be a bad example, because it is nothing a user could just run and try out. This is because the message 50001 does not exist by default in sys.messages and no result is returned. Even if you would return the value of @var1 it would be null without adding a message to the catalog.
I think this could be improved in different ways:
1. If you want to continue using message 50001, add code to add it to the catalog to the example.
2. Add code to return the content of @var1.
3. Add semicolons to the code.
You could also use an existing message if you don't like to include the sp_addmessage part like so:
DECLARE @var1 VARCHAR(200);
SELECT @var1 = FORMATMESSAGE(21874, 'SP1', 'DB1');