Failed to connect to server "machinename" (Microsoft.SqlServer.SmoEnum)

To reproduce the error..

Created a SQL login – Windows Authentication
The default DB = myTempDb

Deleted myTempDb using the Sql Server Management Studio.

Solution:

Change the default Db to master and it solves the problem..
sp_defaultdb ‘MyDomain\Zeeshan’, master

Leave a comment