Поделиться через


Класс ScriptOption

The ScriptOption object represents the SQL Server script options that can be included in scripting options that are set by using the ScriptingOptions object.

Иерархия наследования

System.Object
  Microsoft.SqlServer.Management.Smo.ScriptOption

Пространство имен:  Microsoft.SqlServer.Management.Smo
Сборка:  Microsoft.SqlServer.Smo (в Microsoft.SqlServer.Smo.dll)

Синтаксис

'Декларация
Public NotInheritable Class ScriptOption
'Применение
Dim instance As ScriptOption
public sealed class ScriptOption
public ref class ScriptOption sealed
[<SealedAttribute>]
type ScriptOption =  class end
public final class ScriptOption

Тип ScriptOption обеспечивает доступ к следующим элементам.

Свойства

  Имя Описание
Открытое свойствоСтатический элемент AgentAlertJob Gets an object that specifies whether to include SQL Server Agent alerts and jobs in the script. 
Открытое свойствоСтатический элемент AgentJobId Gets an object that specifies whether to include SQL Server Agent alerts and jobs in the script. 
Открытое свойствоСтатический элемент AgentNotify Gets an object that specifies whether to include notifications for any SQL Server Agent alerts that in the script. 
Открытое свойствоСтатический элемент AllowSystemObjects Gets an object that specifies whether system objects can be scripted or not.
Открытое свойствоСтатический элемент AnsiFile Gets an object that specifies whether the script uses multibyte characters and requires code page 1252 to evaluate characters meaning.
Открытое свойствоСтатический элемент AnsiPadding Gets an object that specifies whether the generated script contains the Transact-SQL statements SET ANSI-PADDING ON and SET ANSI-PADDING OFF before and after the CREATE TABLE statement, respectively.
Открытое свойствоСтатический элемент AppendToFile Gets an object that specifies whether the script is appended to the end of the output file or overwrites it.
Открытое свойствоСтатический элемент Bindings Gets an object that specifies whether the binding statements sp_binddefault and sp_bindrule are included in the generated script. This property applies only when scripting a Microsoft SQL Server table.
Открытое свойствоСтатический элемент ChangeTracking Gets the ChangeTracking property value.
Открытое свойствоСтатический элемент ClusteredIndexes Gets an object that specifies whether statements that define clustered indexes are included in the generated script.
Открытое свойствоСтатический элемент ContinueScriptingOnError Gets an object value that specifies whether the scripting operation continues after an error is encountered.
Открытое свойствоСтатический элемент ConvertUserDefinedDataTypesToBaseType Gets an object value that specifies whether user-defined data types are converted to the most appropriate SQL Server base data types in the generated script. 
Открытое свойствоСтатический элемент DdlBodyOnly Gets an object value that specifies whether to script only the text definition for data definition language (DDL) objects that have a text body, such as stored procedures and triggers.
Открытое свойствоСтатический элемент DdlHeaderOnly Gets an object value that specifies whether to script only the header information for data definition language (DDL) objects that have a text body, such as stored procedures and triggers.
Открытое свойствоСтатический элемент Default Gets an object value that specifies whether the creation of the referenced object is included in the generated script.
Открытое свойствоСтатический элемент DriAll Gets an object value that specifies whether the DRI objects are included in the generated script.
Открытое свойствоСтатический элемент DriAllConstraints Gets an object value that specifies whether all DRI constraints are included in the generated script.
Открытое свойствоСтатический элемент DriAllKeys Gets an object value that specifies whether all DRI keys (DriForeignKeys, DriPrimaryKey, DriUniqueKeys) are included in the generated script.
Открытое свойствоСтатический элемент DriChecks Gets an object value that specifies whether column-specific dependency relationships defined in check constraints with enforced declarative referential integrity are included in the script.
Открытое свойствоСтатический элемент DriClustered Gets an object value that specifies whether dependency relationships defined in clustered indexes with enforced declarative referential integrity are included in the script.
Открытое свойствоСтатический элемент DriDefaults Gets an object value that specifies whether dependency relationships defined in defaults with enforced declarative referential integrity are included in the script.
Открытое свойствоСтатический элемент DriForeignKeys Gets an object value that specifies whether dependency relationships defined in foreign keys with enforced declarative referential integrity are included in the script.
Открытое свойствоСтатический элемент DriIncludeSystemNames Gets an object value that specifies whether the system generated constraint names used to enforce declarative referential integrity are included in the script.
Открытое свойствоСтатический элемент DriIndexes Gets an object value that specifies whether PRIMARY KEY constraints using a unique index to implement the declarative referential integrity are included in the generated script.
Открытое свойствоСтатический элемент DriNonClustered Gets an object value that specifies whether dependency relationships defined in non-clustered indexes with enforced declarative referential integrity are included in the script.
Открытое свойствоСтатический элемент DriPrimaryKey Gets an object value that specifies whether dependency relationships defined in primary keys with enforced declarative referential integrity are included in the script.
Открытое свойствоСтатический элемент DriUniqueKeys Gets an object value that specifies whether dependency relationships defined in unique keys with enforced declarative referential integrity are included in the script.
Открытое свойствоСтатический элемент DriWithNoCheck Gets an object value that specifies whether the no check statement is included in the script.
Открытое свойствоСтатический элемент EnforceScriptingOptions Gets an object value that specifies whether the application of all scripting options is enforced for text base objects, such as SchemaQualify.
Открытое свойствоСтатический элемент ExtendedProperties Gets an object value that specifies whether extended object properties are included in the generated script.
Открытое свойствоСтатический элемент FullTextCatalogs Gets an object value that specifies whether full-text catalogs are included in the generated script.
Открытое свойствоСтатический элемент FullTextIndexes Gets an object value that specifies whether full-text indexes are included in the generated script.
Открытое свойствоСтатический элемент FullTextStopLists Gets an object value that specifies whether full-text stop lists are included in the generated script.
Открытое свойствоСтатический элемент IncludeDatabaseContext Gets an object value that specifies whether database content is included in the generated script.
Открытое свойствоСтатический элемент IncludeDatabaseRoleMemberships Gets the IncludeDatabaseRoleMemberships property value.
Открытое свойствоСтатический элемент IncludeFullTextCatalogRootPath Gets the IncludeFullTextCatalogRootPath property value.
Открытое свойствоСтатический элемент IncludeHeaders Gets an object that specifies whether the generated script is prefixed with a header containing information including the date and time of generation.
Открытое свойствоСтатический элемент IncludeIfNotExists Gets an object that specifies whether to check the existence of an object before including it in the script.
Открытое свойствоСтатический элемент Indexes Gets an object that specifies whether indexes are included in the generated script.
Открытое свойствоСтатический элемент LoginSid Gets or sets the Boolean property value that specifies whether the security identifiers are included for any scripted logins in the generated script.
Открытое свойствоСтатический элемент NoAssemblies Gets an object that specifies whether assemblies are excluded from the generated script.
Открытое свойствоСтатический элемент NoCollation Gets an object value that specifies whether to include the collection in the generated script if the server is running SQL Server 7.0 or later.
Открытое свойствоСтатический элемент NoCommandTerminator Gets an object value that specifies whether individual Transact-SQL statements are delimited in the generated script.
Открытое свойствоСтатический элемент NoExecuteAs Gets an object value that specifies whether the EXECUTE AS options for stored procedures and user-defined functions are included in the script.
Открытое свойствоСтатический элемент NoFileGroup Gets an object value that specifies whether to include the 'ON <filegroup>' clause in the generated script.
Открытое свойствоСтатический элемент NoFileStream Gets an object that specifies whether to include the FILESTREAM_ON clause when you create VarBinaryMax columns in the generated script.
Открытое свойствоСтатический элемент NoFileStreamColumn Gets an object that specifies whether to include the FILESTREAM_ON clause when you create VarBinaryMax columns in the generated script.
Открытое свойствоСтатический элемент NoIdentities Gets an object value that specifies whether definitions of identity property seed and increment are included in the generated script.
Открытое свойствоСтатический элемент NoIndexPartitioningSchemes Gets an object value that specifies whether partition schemes for indexes are included in the generated script.
Открытое свойствоСтатический элемент NoMailProfileAccounts Gets an object value that specifies whether mail accounts referenced by mail profiles are included in the generated script.
Открытое свойствоСтатический элемент NoMailProfilePrincipals Gets an object value that specifies whether principals referenced by mail profiles are excluded from the generated script.
Открытое свойствоСтатический элемент NonClusteredIndexes Gets an object value that specifies whether non-clustered indexes are included in the generated script.
Открытое свойствоСтатический элемент NoTablePartitioningSchemes Gets an object value that specifies whether partition schemes for tables are included in the generated script.
Открытое свойствоСтатический элемент NoVardecimal Gets the NoVardecimal property value.
Открытое свойствоСтатический элемент NoViewColumns Gets an object value that specifies whether to include the specified columns for a view.
Открытое свойствоСтатический элемент NoXmlNamespaces Gets an object value that specifies whether XML namespaces are included in the generated script.
Открытое свойствоСтатический элемент OptimizerData Gets an object value that specifies whether script optimizer data for the referenced objects are included in the generated script.
Открытое свойствоСтатический элемент Permissions Gets an object value that specifies whether to all permissions in the generated script.
Открытое свойствоСтатический элемент PrimaryObject Gets an object value that specifies whether the creation of the referenced object is included in the generated script.
Открытое свойствоСтатический элемент SchemaQualify Gets an object value that specifies whether the script contains object with no schema.
Открытое свойствоСтатический элемент SchemaQualifyForeignKeysReferences Gets an object value that specifies whether tables with no schema that are referenced by a foreign key are included in the generated script.
Открытое свойствоСтатический элемент ScriptBatchTerminator Gets the batch terminator of the script option.
Открытое свойствоСтатический элемент ScriptData Gets the ScriptData property value.
Открытое свойствоСтатический элемент ScriptDataCompression Gets an object value that specifies whether the creation of the referenced object is included in the generated script.
Открытое свойствоСтатический элемент ScriptOwner Gets an object value that specifies whether the creation of the referenced object is included in the generated script.
Открытое свойствоСтатический элемент ScriptSchema Gets the schema of the script option.
Открытое свойствоСтатический элемент Statistics Gets an object value that specifies whether statistics are generated for any table or view included in the generated script.
Открытое свойствоСтатический элемент TimestampToBinary Gets an object value that specifies whether to convert timestamp data types to a binary(8) data types when scripting the creation of a table or user defined data type.
Открытое свойствоСтатический элемент ToFileOnly Gets an object value that specifies whether to output to file only or to generate string output too.
Открытое свойствоСтатический элемент Triggers Gets an object value that specifies whether to include the definition for triggers in the generated script.
Открытое свойствоСтатический элемент WithDependencies Gets an object value that specifies whether to include all dependent objects in the generated script.
Открытое свойствоСтатический элемент XmlIndexes Gets an object value that specifies whether XML indexes are included in the generated script.

В начало

Методы

  Имя Описание
Открытый методСтатический элемент Add Adds the two ScriptOption objects to create a ScriptOptions object.
Открытый методСтатический элемент BitwiseOr Combines two ScriptingOptions object using a Bitwise OR operation.
Открытый метод Equals Returns a Boolean value that specifies if two ScriptOptions are equal. (Переопределяет Object.Equals(Object).)
Открытый метод GetHashCode Returns the hash code for this object. (Переопределяет Object.GetHashCode().)
Открытый метод GetType (Производный от Object.)
Открытый метод ToString Returns a string that represents the current object. (Переопределяет Object.ToString().)

В начало

Операторы

  Имя Описание
Открытый операторСтатический элемент Addition Creates a set of scripting options by performing an addition operation on two ScriptOption objects.
Открытый операторСтатический элемент BitwiseOr Creates a set of scripting options by performing a bitwise OR operation on two ScriptOption objects.
Открытый операторСтатический элемент Implicit(ScriptOption to ScriptingOptions) Implicitly converts the specified ScriptOption to a ScriptingOptions object.

В начало

Замечания

The ScriptOption object contains a property for each type of SQL Server item that can be scripted. The actual set of items to be scripted is specified using the ScriptingOptions object.

Warning: Some script options cause the Transfer object to generate script that does not execute on the target server.

Thread Safety

Все общие статические члены этого типа (Shared в Microsoft Visual Basic) можно использовать в многопоточных операциях. Потокобезопасная работа с членами экземпляров типа не гарантируется.

Примеры

'Connect to the local, default instance of SQL Server.
Dim srv As Server
srv = New Server
'Reference the AdventureWorks2012 database.
Dim db As Database
db = srv.Databases("AdventureWorks2012")
'Define a Scripter object and set the required scripting options.
Dim scrp As Scripter
scrp = New Scripter(srv)
scrp.Options.ScriptDrops = False
scrp.Options.WithDependencies = True
'Iterate through the tables in database and script each one. Display the script.
'Note that the StringCollection type needs the System.Collections.Specialized namespace to be included.
Dim tb As Table
Dim smoObjects(1) As Urn
For Each tb In db.Tables
    smoObjects = New Urn(0) {}
    smoObjects(0) = tb.Urn
    If tb.IsSystemObject = False Then
        Dim sc As StringCollection
        sc = scrp.Script(smoObjects)
        Dim st As String
        For Each st In sc
            Console.WriteLine(st)
        Next
    End If
Next

Безопасность многопоточности

Любые открытые статический (Shared в Visual Basic) элементы этого типа потокобезопасны. Потокобезопасность с элементами экземпляров не гарантируется.

См. также

Справочник

Пространство имен Microsoft.SqlServer.Management.Smo

Другие ресурсы

Создание скриптов