문서를 영문으로 보려면 영문 확인란을 선택하세요. 마우스 포인터를 텍스트 위로 이동시켜 팝업 창에서 영문 텍스트를 표시할 수도 있습니다.
번역
영문

ScriptingOptions 클래스

The ScriptingOptions object provides programmatic options to the options that can be set for scripting operations.

System.Object
  Microsoft.SqlServer.Management.Smo.ScriptingOptions

네임스페이스:  Microsoft.SqlServer.Management.Smo
어셈블리:  Microsoft.SqlServer.Smo(Microsoft.SqlServer.Smo.dll)

public sealed class ScriptingOptions

ScriptingOptions 유형에서 다음 멤버를 표시합니다.

  이름설명
공용 메서드ScriptingOptions()Initializes a new instance of the ScriptingOptions class.
공용 메서드ScriptingOptions(ScriptingOptions)Initializes a new instance of the ScriptingOptions class based on the specified scripting options.
공용 메서드ScriptingOptions(ScriptOption)Initializes a new instance of the ScriptingOptions class based on the specified ScriptOption object, based on the specified script option.
맨 위로 이동

  이름설명
공용 속성AgentAlertJobGets or sets the Boolean property that specifies whether to include SQL Server Agent job name for alert objects in the script.
공용 속성AgentJobIdGets or sets the Boolean property that specifies whether to include SQL Server Agent job ID values for alert objects in the script.
공용 속성AgentNotifyGets or sets the Boolean property that specifies whether to include notifications for any SQL Server Agent alerts that are in the script.
공용 속성AllowSystemObjectsGets or sets the Boolean property that specifies whether system objects can be scripted.
공용 속성AnsiFileGets or sets the Boolean property that specifies whether the script uses multibyte characters and requires code page 1252 to evaluate characters' meaning.
공용 속성AnsiPaddingGets or sets a Boolean property 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.
공용 속성AppendToFileGets or sets a Boolean property value that specifies whether the script is appended to the end of the output file or overwrites it.
공용 속성BatchSizeGets or sets the number of statements after which to script batch terminator.
공용 속성BindingsGets or sets a Boolean property value that specifies whether the binding statements sp_binddefault and sp_bindrule are included in the generated script. This property applies only when scripting a SQL Server table.
공용 속성ChangeTrackingGets or sets whether the ScriptingOptions tracking changes.
공용 속성ClusteredIndexesGets or sets a Boolean property value that specifies whether statements that define clustered indexes are included in the generated script.
공용 속성ContinueScriptingOnErrorGets or sets the Boolean property value that specifies whether the scripting operation continues after an error is encountered.
공용 속성ConvertUserDefinedDataTypesToBaseTypeGets or sets the Boolean property value that specifies whether user-defined data types are converted to the most appropriate SQL Server base data types in the generated script.
공용 속성DdlBodyOnlyGets or sets the Boolean property 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.
공용 속성DdlHeaderOnlyGets or sets the Boolean property 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.
공용 속성DefaultGets or sets the Boolean property value that specifies whether the creation of the referenced object is included in the generated script.
공용 속성DriAllGets or sets the Boolean property value that specifies whether all DRI objects are included in the generated script.
공용 속성DriAllConstraintsGets or sets the Boolean property value that specifies whether all declarative referential integrity constraints are included in the generated script.
공용 속성DriAllKeysGets or sets the Boolean property value that specifies whether the dependency relationships defined by all declarative referential integrity keys are included in the generated script.
공용 속성DriChecksGets or sets the Boolean property value that specifies whether column specific dependency relationships as defined in check constraints with enforced declarative referential integrity are included in the script.
공용 속성DriClusteredGets or sets the Boolean property value that specifies whether dependency relationships defined in clustered indexes with enforced declarative referential integrity are included in the script.
공용 속성DriDefaultsGets or sets the Boolean property value that specifies whether dependency relationships defined in defaults with enforced declarative referential integrity are included in the script.
공용 속성DriForeignKeysGets or sets the Boolean property value that specifies whether dependency relationships defined in foreign keys with enforced declarative referential integrity are included in the script.
공용 속성DriIncludeSystemNamesGets or sets the Boolean property value that specifies whether the system-generated constraint names that are used to enforce declarative referential integrity are included in the script.
공용 속성DriIndexesGets or sets the Boolean property value that specifies whether PRIMARY KEY constraints that use a unique index to implement the declarative referential integrity are included in the script.
공용 속성DriNonClusteredGets or sets the Boolean property value that specifies whether dependency relationships that are defined in non-clustered indexes that have enforced declarative referential integrity are included in the script.
공용 속성DriPrimaryKeyGets or sets the Boolean property value that specifies whether dependency relationships that are defined in primary keys which have enforced declarative referential integrity are included in the script.
공용 속성DriUniqueKeysGets or sets the Boolean property value that specifies whether dependency relationships that are defined in unique keys which have enforced declarative referential integrity are included in the script.
공용 속성DriWithNoCheckGets or sets the Boolean property value that specifies whether the no check statement is included in the script.
공용 속성EncodingGets or sets the encoding for the scripting options.
공용 속성EnforceScriptingOptionsGets or sets the Boolean property value that specifies whether the application of all scripting options is enforced for text-based objects, such as SchemaQualify.
공용 속성ExtendedPropertiesGets or sets the Boolean property value that specifies whether extended object properties are included in the generated script.
공용 속성FileNameGets or sets the name of the file to which the generated script is output.
공용 속성FullTextCatalogsGets or sets the Boolean property value that specifies whether full-text catalogs are included in the generated script.
공용 속성FullTextIndexesGets or sets the Boolean property value that specifies whether full-text indexes are included in the generated script.
공용 속성FullTextStopListsGets or sets the Boolean property value that specifies whether full-text stop lists are included in the generated script.
공용 속성IncludeDatabaseContextGets or sets the Boolean property value that specifies whether database context is included in the generated script.
공용 속성IncludeDatabaseRoleMembershipsGets or sets a value that indicates whether the database role memberships are included.
공용 속성IncludeFullTextCatalogRootPathGets or sets a value that indicates whether the full text catalog root path is included.
공용 속성IncludeHeadersGets or sets a Boolean property value that specifies whether the generated script is prefixed with a header that contains information which includes the date and time of generation.
공용 속성IncludeIfNotExistsGets or sets a Boolean property value that specifies whether to check the existence of an object before including it in the script.
공용 속성IndexesGets or sets the Boolean property value that specifies whether indexes are included in the generated script.
공용 속성LoginSidGets or sets the Boolean property value that specifies whether the security identifiers are included for any scripted logins in the generated script.
공용 속성NoAssembliesGets or sets the Boolean property value that specifies whether assemblies are included in the generated script.
공용 속성NoCollationGets or sets the Boolean property value that specifies whether to include the collation clause in the generated script.
공용 속성NoCommandTerminatorGets or sets the Boolean property value that specifies whether individual Transact-SQL statements are delimited in the generated script.
공용 속성NoExecuteAsGets or sets the Boolean property value that specifies whether the EXECUTE AS options for stored procedures and user-defined functions are included in the script.
공용 속성NoFileGroupGets or sets the Boolean property value that specifies whether to include the 'ON <filegroup>' clause in the generated script.
공용 속성NoFileStreamGets or sets an object that specifies whether to include the FILESTREAM_ON clause when you create VarBinaryMax columns in the generated script.
공용 속성NoFileStreamColumnGets or sets an object that specifies whether to include the FILESTREAM_ON clause when you create VarBinaryMax columns in the generated script.
공용 속성NoIdentitiesGets or sets the Boolean property value that specifies whether definitions of identity property seed and increment are included in the generated script.
공용 속성NoIndexPartitioningSchemesGets or sets the Boolean property value that specifies whether partition schemes for indexes are included in the generated script.
공용 속성NoMailProfileAccountsGets or sets the Boolean property value that specifies whether mail accounts that are referenced by mail profiles are included in the generated script.
공용 속성NoMailProfilePrincipalsGets or sets the Boolean property value that specifies whether principals that are referenced by mail profiles are included in the generated script.
공용 속성NonClusteredIndexesGets or sets the Boolean property value that specifies whether non-clustered indexes are included in the generated script.
공용 속성NoTablePartitioningSchemesGets or sets the Boolean property value that specifies whether partition schemes for tables are included in the generated script.
공용 속성NoVardecimalGets or sets an object that specifies whether to include the N clause when you create vardecimal columns in the generated script.
공용 속성NoViewColumnsGets or sets the Boolean property value that specifies whether to include the specified columns for a view.
공용 속성NoXmlNamespacesGets or sets the Boolean property value that specifies whether XML namespaces are included in the generated script.
공용 속성OptimizerDataGets or sets the Boolean property value that specifies whether script optimizer data for the referenced objects are included in the generated script.
공용 속성PermissionsGets or sets the Boolean property value that specifies whether to include all permissions in the generated script.
공용 속성PrimaryObjectGets or sets the Boolean property value that specifies whether the creation of the referenced object is included in the generated script.
공용 속성SchemaQualifyGets or sets the Boolean property value that specifies whether the schemas associated with objects are included in the generated script.
공용 속성SchemaQualifyForeignKeysReferencesGets or sets the Boolean property value that specifies whether schema-qualified table references for foreign key constraints are included in the generated script.
공용 속성ScriptBatchTerminatorGets or sets the ScriptBatchTerminator property value.
공용 속성ScriptDataGets or sets the ScriptData property value.
공용 속성ScriptDataCompressionGets or sets the Boolean property value that specifies whether to include data compression information in the generated script.
공용 속성ScriptDropsGets or sets the Boolean property value that specifies whether the script operation generates a Transact-SQL script to remove the referenced component.
공용 속성ScriptOwnerGets or sets the Boolean property value that specifies whether the script owner is included in the generated script.
공용 속성ScriptSchemaGets or set the ScriptSchema property value.
공용 속성StatisticsGets or sets the Boolean property value that specifies whether to include statistics for any table or view that is included in the generated script.
공용 속성TargetDatabaseEngineTypeGets or sets the DatabaseEngineType property value.
공용 속성TargetServerVersionGets or sets the version of the instance of SQL Server for which the generated script is intended.
공용 속성TimestampToBinaryGets or sets the Boolean property value that specifies whether to convert timestamp data types to binary(8) data types when scripting the creation of a table or user-defined data type.
공용 속성ToFileOnlyGets or sets the Boolean property value that specifies whether to output to file only or to also generate string output.
공용 속성TriggersGets or sets the Boolean property value that specifies whether to include the definition for triggers in the generated script.
공용 속성WithDependenciesGets or sets the Boolean property value that specifies whether to include all dependent objects in the generated script.
공용 속성XmlIndexesGets or sets the Boolean property value that specifies whether XML indexes are included in the generated script.
맨 위로 이동

  이름설명
공용 메서드Add(ScriptOption)Adds a ScriptOption object to the ScriptingOptions object.
공용 메서드정적 멤버Add(ScriptingOptions, ScriptOption)Adds the specified ScriptOption and ScriptingOptions objects to the ScriptingOptions.
공용 메서드정적 멤버ConvertVersionConverts the server version to a SqlServerVersion value.
공용 메서드Equals (Object에서 상속됨)
공용 메서드GetHashCode (Object에서 상속됨)
공용 메서드GetType (Object에서 상속됨)
공용 메서드RemoveRemoves a ScriptOption object from the ScriptingOptions object.
공용 메서드SetTargetDatabaseEngineTypeSets the database engine type as specified in a DatabaseEngineType object.
공용 메서드SetTargetServerVersionSets the version of the instance of SQL Server on which the scripting operation is run.
공용 메서드정적 멤버SubtractSubtracts the specified ScriptOption value from the specified ScriptingOptions object.
공용 메서드ToStringReturns a string that represents the ScriptingOptions object. (Object.ToString()을(를) 재정의함)
맨 위로 이동

  이름설명
공용 연산자정적 멤버AdditionCreates a set of scripting options by performing an addition operation on a ScriptingOptions object and a ScriptOption object.
공용 연산자정적 멤버SubtractionCreates a set of scripting options by performing an subtraction operation on a ScriptingOptions object and a ScriptOption object.
맨 위로 이동

주의 사항주의

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

Thread Safety

이 유형의 모든 public static(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

PowerShell

$srv = New-Object Microsoft.SqlServer.Management.Smo.Server("(local)")
$db = New-Object Microsoft.SqlServer.Management.Smo.Database
$db = $srv.Databases.Item("AdventureWorks2012")
$scrp = New-Object Microsoft.SqlServer.Management.Smo.Scripter($srv)
$scrp.Options.ScriptDrops = $FALSE
$scrp.Options.WithDependencies = $TRUE
$tb = New-Object Microsoft.SqlServer.Management.Smo.Table
#$smoObjects = new-object Microsoft.SqlServer.Management.Smo.Urn[]0
$smoObjects = $tb.Urn
foreach ($tb in $db.Tables)
{
   $smoObjects = $tb.Urn
   if ($tb.IsSystemObject -eq $FALSE)
   {
      $sc = $scrp.Script($smoObjects)
      foreach ($st in $sc)
      {
         Write-Host $st
      }
   }
}

이 유형의 모든 공용 static(Visual Basic에서는 Shared) 멤버는 스레드로부터 안전합니다. 인스턴스 멤버는 스레드로부터의 안전성이 보장되지 않습니다.

커뮤니티 추가 항목

추가
표시: