SSMS clean output window with sql instruction How can i clean output window in SSMS using t-sql syntax? Is it possible ?
Do you know any workarounds ?
This is not possible to do within the context of a single execution of whatever is in the Query pane. T-SQL commands are not interpreted by SSMS. They are sent to SQL Server to be processed. Only a GO [execution_count] statement (batch separator, GO being the default but can be changed) and a subset of the SQLCMD commands -- !!, :exit, :quit, :r, :setvar, :connect, :on error, :error, and :out -- are captured and processed by SSMS (and are not sent to SQL Server).

Also, there aren't even any internal SSMS commands to clear either the Results tab or the Messages tab.

So, if there are any results being returned, they will be in the Results tab at the end of the execution no matter what.

BUT, after that execution ends, you can manually clear both the "Results" and "Messages" tabs by highlighting an empty line (or even just a space on a non-empty line) and hitting F5 or Control + E.

OR, depending on why this is being requested, you can hide the "Results" and "Messages" tabs by hitting Control + R.