Using T-SQL to Set Database Options

If you prefer to use T-SQL, or if the option you need to set doesn’t appear in the Database Properties dialog, you can use the ALTER DATABASE command to set options. For example, the following command sets AUTO_UPDATE STATISTICS to OFF in the AdventureWorks2008 database:

image

You can also change some of the options by using the system stored procedure sp_dboption. This feature is scheduled to be removed in a future release of SQL Server but is still available in this release. You might still be using this procedure based on prior releases, and old habits are hard to break. Following is an example of one of the ...

Get Microsoft® SQL Server 2008 R2 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.