ms sql server how to set a default database owner code example Example: how to set default database name in sql server Exec sp_defaultdb @loginame='login', @defdb='master'