10 July,2012 by Jack Vamvas
Question: How can I open the SQL Server Management Studio (SSMS) from the command Line? I want to create a batch file , place it on a users desktop (or personal folder) . The batch file should have a command line instructions to open the SSMS and connect to a SQL Server Instance with the users Active Directory (AD) credentials.
Answer: The ssms utility , which is part of the SQL Server Management Studio installation, can open SSMS. A simple example , which opens SSMS , connects to a SQL Server Instance with the users Windows logon details. Adding the –nosplash parameter , stops the SSMS splash screen from appearing.
ssms -E -S MYSERVER\MYINST1 -nosplash
If the SSMS Object Explorer does not appear , a modification needs to occur on the Tools | Options section.
Open the SSMS Options with Tools | Options
In the Environment | General Section - on the right panel you’ll see At Startup : Open Object Explorer
Change the default At startup to Open Object Explorer and new query.
Run the command again – and if you logon successfully the Object Explorer will appear
Now it’s just a matter of placing the command line in a batch file , and it can be a reusable script.
Other options exist for the ssms utility – including SQL Server logon and scriptfile options. Read SQL Server Books Online for more details
A common issue with SSMS is the memory limit of returning recordsets surpassing the 2 GB limit read more on How to fix System.OutOfMemoryException when using SSMS