Error 4064

  • I'm getting the following error when I clicked on the 'Check Syntax' box of the Stored procedure properties:

    Error 4064:  Cannot open user default database. Login failed.

    I have SQL 2000 Enterprise Manager sp3

    I tried several solutions from Microsoft site, but nothing helps.  Thanks.

  • Sounds like that user's default database is screwed in some way (might be permissions, the database might be offline or suspect etc..). You need to login as an administrator and run ALTER LOGIN <loginName> WITH default_database=master

    If it is your admin account you are logging in with then you will need to connect to SQL Server using the following command at the command prompt (make sure sqlcmd is in your path or your current directory):

    C:\> sqlcmd -E -d master

    1> ALTER LOGIN [BUILTIN\Administrators] WITH DEFAULT_DATABASE=master

    2> GO

    OR if you use sql server auth

    C:\> sqlcmd -u sa -p ****** -d master

    1> ALTER LOGIN [sa] WITH DEFAULT_DATABASE=master

    2> GO

    HTH,

    - James

    --
    James Moore
    Red Gate Software Ltd

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply