如何更改SQL Server中,默認啟始的數據庫?

MS-SQL Server Management Studio (SSMS) [v2005] provides a way to change this. And next time onwards this nerw selected database will selected by default instead of the MASTER DB.

Steps:

  1. Open Sql Server Management Studio
  2. Go to object Explorer -> Security –> Logins
  3. Right click on the login and select properties
  4. And in the properties window change the default database and click OK.

image
image
image

 

另外,也可以使用指令來操作:


Exec sp_defaultdb @loginame='TestUser', @defdb='Test'



Important: 【使用須知】



This feature will be removed in a future version of Microsoft SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feature.

Use ALTER LOGIN instead.

沒有留言: