How do I specify a recovery model (full, simple or bulk-logged) when creating a database in a CREATE DATABASE query in T-SQL code?
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With