Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I see a login's default database?

I need to detect a login's default database. Which system table/view should I query for that in SQL Server 2005?

like image 576
Vitali Climenco Avatar asked Apr 02 '10 05:04

Vitali Climenco


People also ask

How do I find my default database collation?

To see the default collation for each character set, use the SHOW CHARACTER SET statement or query the INFORMATION_SCHEMA CHARACTER_SETS table. If COLLATE collation_name is specified without CHARACTER SET , the character set associated with collation_name and collation collation_name are used.

What is default database for login in SQL Server?

login can be an existing SQL Server login or a Windows user or group. If a login for the Windows user or group does not exist in SQL Server, it is automatically added. [ @defdb = ] 'database' Is the name of the new default database. database is sysname, with no default.

How can I see all databases on a server?

To view a list of databases on an instance of SQL Server. In Object Explorer, connect to an instance of the SQL Server Database Engine, and then expand that instance. To see a list of all databases on the instance, expand Databases.


1 Answers

The master.sys.syslogins view is provided for backward compatibility and will be removed in future. You should use sys.server_principals view and the column default_database_name.

like image 148
Piotr Rodak Avatar answered Sep 19 '22 23:09

Piotr Rodak