To check nullability of the current database
IF GETANSINULL() = 1
PRINT 'ANSI_NULL_DEFAULT is ON of the current database.'
ELSE
PRINT 'ANSI_NULL_DEFAULT is OFF of the current database.'
To check nullability of the specified database
IF GETANSINULL('YourDatabaseName') = 1
PRINT 'ANSI_NULL_DEFAULT is ON of the current database.'
ELSE
PRINT 'ANSI_NULL_DEFAULT is OFF of the current database.'
To set nullability of the current database to ON
IF GETANSINULL() = 1
ALTER DATABASE YourDatabaseName SET ANSI_NULL_DEFAULT ON
ELSE
ALTER DATABASE YourDatabaseName SET ANSI_NULL_DEFAULT OFF
No comments:
Post a Comment