简体   繁体   中英

How do I specify a recovery model (full, simple or bulk-logged) when creating a database in T-SQL code?

在T-SQL代码中的CREATE DATABASE查询中创建数据库时,如何指定恢复模型(完整,简单或批量记录)?

Using TSQL, it's part of ALTER DATABASE not CREATE DATABASE.

CREATE DATABASE MyDatabase;
ALTER DATABASE MyDatabase SET RECOVERY SIMPLE;

However, it will inherit the setting from the Model system database, so change that to what you want if it's a common setting.

http://msdn.microsoft.com/en-us/library/ms176061.aspx

http://msdn.microsoft.com/en-us/library/ms190249.aspx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM