Simple script to get logins and default database names Mon Jun 14, 2010 by Peter Larsson in sql-server-2008, administration, sql-server-2005 SELECT u.name, l.dbname FROM sys.sysusers AS u INNER JOIN sys.syslogins AS l ON l.sid = u.sid