1

Once I connect to a database server without specifying a particular database, e.g. with:

sqsh -Usomeuser -Ssomeserver

… I can do a:

select db_name();

… to see the default database for this user. But where is this information kept and / or how can I see the default databases configured for every user name or login name?

1

Running the following code shows the default database on ASE:

SELECT sl.name
    , sl.dbname
FROM syslogins sl
ORDER BY sl.name;
  • I get syslogins not found. Specify owner.objectname or use sp_help to check whether the object exists Trying with master.syslogins produces the same result. – Marcus Junius Brutus Jan 18 '17 at 21:12
  • 1
    You don't have rights to see it, most likely. It is in master, so you could specify it as master.dbo.syslogins – Max Vernon Jan 18 '17 at 22:11
  • Another thing is that I noticed that the association is from login names (not user names) to databases. Is that correct? – Marcus Junius Brutus Jan 18 '17 at 23:26
1

About default DB:

  • default DB per login is held in the master DB system table syslogins column dbname
  • this column is selectable by public group (everyone is in this group) i.e. select permission is granted to public
  • alternative is to execute the system stored procedure sp_displaylogin <loginname> to display the default DB

You can check access permissions using exec sp_helprotect syslogins within the context of master DB.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.