can’t login into SQL due to default DB not set to master

31 Mar

What you can do is set your default database using the sp_defaultdb system stored procedure. Log in as you have done and then click the New Query button.

After that simply run the sp_defaultdb command as follows:
Exec sp_defaultdb @loginame=’login’, @defdb=’master’

 

C:\> sqlcmd -E -d master

1> sp_defaultdb @loginame=’domain\login’, @defdb=’master’

2> GO