Freigeben über


SSMS Command line params

This is something that I don't think many people are familiar with. I'm a little hesitent to mention them as it is a bit of the "use a screwdriver as a hammer" type solution. But here we go.

SSMS has a number of command line options which allow you to specify a number of things. These can be seen by executing the /? command. Here are the results of that command.

---------------------------
Microsoft SQL Server Management Studio
---------------------------
Usage:
sqlwb.exe [-S server_name[\instance_name]] [-d database] [-U user] [-P password] [-E] [file_name[, file_name]] [/?]

 [-S The name of the SQL Server instance to which to connect]
 [-d The name of the SQL Server database to which to connect]
 [-E] Use Windows Authentication to login to SQL Server
 [-U The name of the SQL Server login with which to connect]
 [-P The password associated with the login]
 [file_name[, file_name]] names of files to load
 [-nosplash] Supress splash screen
 [/?] Displays this usage information
---------------------------
OK  
---------------------------

Of course the first thing to notice is that the command line is sqlwb.exe and not ssms.exe. This is just a left over from the early days where it was called Sql Workbench. Changing the name late in the cycle is much more trouble than you can imagine, so we left it alone.

A serious problem with this is that we don't do wild card expansion of the file name (ugh!) but that is workable.

Now, you may wonder why I'm hesitent to point this out. That is because SSMS is really a tool built to handle visual interaction and not really designed to do much "batch" processing. It can of course do some batch processing and does handle several scenerios well but there are much better tools that support batch.

SqlCmd is a great example of this. This tool provides all sorts of rich macro replacements in scripts so you can write generic scripts and execute them against whatever servers you would like. That being said I do realize that the UI tools need to do a better job in some of these "batch" type scenerios and it something we are looking into to.

Finally you can help us know what you really would like to see by going to the "Send Feedback" menu item under the Community menu in SSMS. This will take you to a site where you can make suggestions and even more powerfull, vote on the sugestions made by others. We do look at this data very seriously and use it as we try and determine what we should be fixing first and foremost.