Link to home
Start Free TrialLog in
Avatar of kzsigo
kzsigo

asked on

How to change the default database using SQL Server Management Studio

I don't see how to change the default database.

I have an ODBC connection in which I can tell it to use a different database than what the default database is, but if I delete that default database the ODBC connections fail. So I need to change the default database.
Avatar of Aneesh
Aneesh
Flag of Canada image

try this query

exec sp_defaultdb 'LoginName', 'NewDefltDBName'

This works in SQL 2k
Avatar of kzsigo
kzsigo

ASKER

this ran without an error, but did not seem to work.
ASKER CERTIFIED SOLUTION
Avatar of Aneesh
Aneesh
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Points to aneeshattingal