sp_dboption (version 6.5)

Displays or changes the database options.

Syntax

sp_dboption [ dbname , 'optname' ] [ , {TRUE | FALSE } ]

In earlier releases of SQL Server, omitting the optname parameter qualifier (true or false) resulted in a runtime error. In SQL Server 6.5, if the optname parameter is not qualified by true or false, the current setting of the optname option specified is returned.

For additional syntax information for sp_dboption, see the Microsoft SQL Server Transact-SQL Reference.

Remarks

The sp_dboption stored procedure returns current settings if the optname parameter setting is omitted. Otherwise, sp_dboption functions as in earlier releases.

Example

This example returns the current setting for the published column from the pubs database.

sp_dboption pubs, 'published'
  

This is the results set:

OptionName             Current Setting 
--------------------   -------------- 
published              off
  
Second example:
sp_dboption pubs, 'published', false