Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set default server connection.

Status
Not open for further replies.

sparkbyte

Technical User
Sep 20, 2002
879
US
Is there a setting on SQL server to set a default DB for all users unless the user has one explicitly assigned?

SQL Server 2005

Thanks

John Fuhrman
 
Not as far as I know.

I think you can do it in 2008 though, but don't quote me on it...

--------------------
Procrastinate Now!
 
You can write a query that can script this out for you. Assuming I understand your requirements...

Code:
Select 'Alter Login [' + Name + '] With DEFAULT_DATABASE = MyDatabaseName'
From   sys.syslogins
Where  dbname = 'Master'

When you run the code shown above, it will display in the output window. You should be able to copy/paste the output window to a new query window and run it. This also gives you an opportunity to see what logins will be modified before actually changing anything.

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
I found the problem. When I removed one of the databases the "builtin/users" lost the default database setting.

Appearently this is used for your initial DB connection if your ID is not defined explicitly in SQL server user security.

I set it to master and everything started working normaly again.


Thanks

John Fuhrman
 
lol, so when you say all users, you actually just mean one user...

--------------------
Procrastinate Now!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top