How to see where the default database is configured for a particular username or login name?
-
05-10-2020 - |
Domanda
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?
Soluzione
Running the following code shows the default database on ASE:
SELECT sl.name
, sl.dbname
FROM syslogins sl
ORDER BY sl.name;
Altri suggerimenti
About default DB:
- default DB per login is held in the master DB system table
syslogins
columndbname
- 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.
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a dba.stackexchange