Pages

Tuesday, September 23, 2014

How to set SQL Server Database Option

Dear Reader,...
Sometimes we need to set SQL Server database option because there is error related on it based on purpose. In this article, we will discuss about how to SQL Server Database Option.

For the first time, you need to query the options of database as below
SELECT
    database_id,
    name, 
    is_ansi_nulls_on,
    is_ansi_padding_on,
    is_ansi_warnings_on,
    is_arithabort_on,
    is_concat_null_yields_null_on,
    is_numeric_roundabort_on,
    is_quoted_identifier_on
FROM sys.databases
where name='[database_name]'
You will get the result of every options that queried. To change the value of options, simply execute the script below
ALTER DATABASE [database_name] SET ANSI_NULLS ON;
GO
ALTER DATABASE [database_name] SET ANSI_PADDING ON;
GO
ALTER DATABASE [database_name] SET ANSI_WARNINGS ON;
GO
ALTER DATABASE [database_name] SET ARITHABORT ON;
GO
ALTER DATABASE [database_name] SET QUOTED_IDENTIFIER ON;
GO
ALTER DATABASE [database_name] SET CONCAT_NULL_YIELDS_NULL ON;
GO
ALTER DATABASE [database_name] SET NUMERIC_ROUNDABORT OFF;
GO

No comments:

Post a Comment

Don't Forget To Join Our Community
×
Widget