I am using sql server 2008 R2 and in 1 scenario i need to change the default database from “master” to the “Test” as soon as i click on the New Query it will select default database to “Test”. for this i am using following query to change the database priority,
Exec sp_defaultdb @loginame='sa',@defdb='Test'
i am able to change the default database to Test for sa Login but i wanted to change it in the Windows authentication mode i am connecting database using (local).
can any one know about what is the default user when we do login to the SSMS using Windows Authentication Mode. or any other solution to change the priority of database to Test?.
Thanks! in advanced.
In Windows authentication mode Your credentials to SQL Server are the same, like in Your System. For Example, in Non-Domain Environment, if Your Computer name is CPU, and login is USER, then Windows Authentication credentials would be : CPU\USER. If You try to connect from other PC, credentials would be different.
So, for answer for Your question : there is no default user when we do login to SSMS using Windows Authentication Mode.
For second question : You can do it for Windows Authentication User like in this example :