SQL Server/T-SQL Tutorial/System Functions/sp dboption

Материал из SQL эксперт
Перейти к: навигация, поиск

ANSI null default

   <source lang="sql">

When set to True, SQL Server follows the SQL 92 rules to see if a column can allow NULL values.

EXEC sp_dboption "YourDatabaseName", "ANSI null default", "False" GO</source>


autoclose - ensures that the database is cleaned up.

   <source lang="sql">

EXEC sp_dboption "YourDatabaseName", "autoclose", "True" GO</source>


autoshrink - A setting of True indicates that that this database can be shrunk in size safely.

   <source lang="sql">

EXEC sp_dboption "YourDatabaseName", "autoshrink", "False" GO</source>


dbo use - If set to True means that only the user ID that created the database has access and can use the database.

   <source lang="sql">

EXEC sp_dboption "YourDatabaseName", "dbo use", "False" GO</source>


quoted identifier

   <source lang="sql">

By setting this to OFF, you can delimit a string by either a single quote or a double quote. when set to ON, you cannot use double quotes around string variables as double quotes will be signifying a SQL Server identifier.

EXEC sp_dboption "YourDatabaseName", "quoted identifier", "True" GO</source>


read only - If set to True, no modifications to the data can be made.

   <source lang="sql">

EXEC sp_dboption "YourDatabaseName", "read only", "False" GO</source>


single - When set to True, only one user has access to the database at a time.

   <source lang="sql">

EXEC sp_dboption "YourDatabaseName", "single", "False" GO</source>


sp_dboption [databasename,option,{TRUE�FALSE}]

   <source lang="sql">

sp_dboption sales,"offline",FALSE</source>


sp_dboption is a system function that allows a specific database option to be set.

   <source lang="sql">

EXEC sp_dboption "YourDatabaseName", "autoclose", "True" GO</source>