SQL Server/T-SQL Tutorial/System Functions/sp dboption
Содержание
- 1 ANSI null default
- 2 autoclose - ensures that the database is cleaned up.
- 3 autoshrink - A setting of True indicates that that this database can be shrunk in size safely.
- 4 dbo use - If set to True means that only the user ID that created the database has access and can use the database.
- 5 quoted identifier
- 6 read only - If set to True, no modifications to the data can be made.
- 7 single - When set to True, only one user has access to the database at a time.
- 8 sp_dboption [databasename,option,{TRUE�FALSE}]
- 9 sp_dboption is a system function that allows a specific database option to be set.
ANSI null default
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
autoclose - ensures that the database is cleaned up.
EXEC sp_dboption "YourDatabaseName", "autoclose", "True"
GO
autoshrink - A setting of True indicates that that this database can be shrunk in size safely.
EXEC sp_dboption "YourDatabaseName", "autoshrink", "False"
GO
dbo use - If set to True means that only the user ID that created the database has access and can use the database.
EXEC sp_dboption "YourDatabaseName", "dbo use", "False"
GO
quoted identifier
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
read only - If set to True, no modifications to the data can be made.
EXEC sp_dboption "YourDatabaseName", "read only", "False"
GO
single - When set to True, only one user has access to the database at a time.
EXEC sp_dboption "YourDatabaseName", "single", "False"
GO
sp_dboption [databasename,option,{TRUE�FALSE}]
sp_dboption sales,"offline",FALSE
sp_dboption is a system function that allows a specific database option to be set.
EXEC sp_dboption "YourDatabaseName", "autoclose", "True"
GO