SQLCMD:- Informational Message – “Changed database context to ….”


Let us quickly address a message pattern that is familiar to those who use sqlcmd.


The message reads “Changed database context to ….”


It is sourced to the presence of “use [database]” within a SQL command or file.



We have a bit of control over whether SQL Server emits the message by adding the “-m” argument.




Value Meaning Sample
Changed database context to ‘tempdb’.
-m-1 Show all messages Msg 5701, Level 0, State 1, Server lab, Line 1
Changed database context to ‘tempdb’.
-m0 Show information messages Changed database context to ‘tempdb’.
-m1 Suppress messages with severity level less than 1 Nothing displayed



Crediting StackOverflow.

Christian K.




Started out like over 25 years ago with C, C++ and then some Java, as well as all sorts of scripting languages on UNIX systems. A whole boat load of CORBA and other stuff around distributed computing. Since the last decade, doing .NET-based development on Windows. Mostly managed, but sometimes native stuff as well.




  1. StackOverflow
    • How to stop the “Changed database context to …” message
  2. Microsoft
    • SQLCMD
      • SQLCMD Utility

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s