10

I tried:

ALTER LOGIN  user
WITH DEFAULT_DATABASE = defaultDB

but it says:

Line 1: Incorrect syntax near 'LOGIN'.

I know this works in 2005+ but is there a different way in 2000?

2 Answers 2

14
exec sp_defaultdb @loginame='someone', @defdb='dbname'

Or since there are only those 2 parameters,

exec sp_defaultdb 'someone', 'dbname'
Sign up to request clarification or add additional context in comments.

1 Comment

You are incredible, thanks. I was having problems with Navicat and DBComparer, they just couldn't connect to the database, because we removed the database that was related to the user we were using to log into the database server. Binding the user to an existing database fixed the issue.
0

Abe, the ALTER LOGIN statement was introduced in SQL Server 2005, you must try using the sp_defaultdb stored procedure how @cyberkiwi suggest.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.