Dela via


UserOptions.AnsiNullDefaultOn Property

Gets or sets the Boolean property value that specifies whether new columns created allow null values by default or not.

Namespace:  Microsoft.SqlServer.Management.Smo
Assembly:  Microsoft.SqlServer.Smo (in Microsoft.SqlServer.Smo.dll)

Syntax

'Declaration
<SfcPropertyAttribute(SfcPropertyFlags.None Or SfcPropertyFlags.Standalone Or SfcPropertyFlags.Deploy,  _
    "true")> _
Public Property AnsiNullDefaultOn As Boolean
    Get
    Set
'Usage
Dim instance As UserOptions
Dim value As Boolean

value = instance.AnsiNullDefaultOn

instance.AnsiNullDefaultOn = value
[SfcPropertyAttribute(SfcPropertyFlags.None|SfcPropertyFlags.Standalone|SfcPropertyFlags.Deploy, 
    "true")]
public bool AnsiNullDefaultOn { get; set; }
[SfcPropertyAttribute(SfcPropertyFlags::None|SfcPropertyFlags::Standalone|SfcPropertyFlags::Deploy, 
    L"true")]
public:
property bool AnsiNullDefaultOn {
    bool get ();
    void set (bool value);
}
[<SfcPropertyAttribute(SfcPropertyFlags.None|SfcPropertyFlags.Standalone|SfcPropertyFlags.Deploy, 
    "true")>]
member AnsiNullDefaultOn : bool with get, set
function get AnsiNullDefaultOn () : boolean
function set AnsiNullDefaultOn (value : boolean)

Property Value

Type: System.Boolean
A Boolean value that specifies the whether newly created columns allow nulls by default or not.
If True, new columns created allow null values by default.
If False (default), new columns create do not allow null values by default.

Remarks

This property is mutually exclusive of the AnsiNullDefaultOff property. An exception occurs if you attempt to set both properties to True simultaneously. In SQL Server Management Objects (SMO) the default nullability of a new column can be overridden by setting the Nullable property of the Column object. In Transact-SQL the default nullability of a new column can be overridden by adding the NULL or NOT NULL clause to the CREATE or ALTER TABLE statement.