Ce sujet n'a pas encore été évalué - Évaluez ce sujet

Classe 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

Espace de noms :  Microsoft.SqlServer.Management.Smo
Assembly :  Microsoft.SqlServer.Smo (en Microsoft.SqlServer.Smo.dll)
public sealed class ScriptOption

Le type ScriptOption expose les membres suivants.

  NomDescription
Propriété publiqueMembre statiqueAgentAlertJobGets an object that specifies whether to include SQL Server Agent alerts and jobs in the script. 
Propriété publiqueMembre statiqueAgentJobIdGets an object that specifies whether to include SQL Server Agent alerts and jobs in the script. 
Propriété publiqueMembre statiqueAgentNotifyGets an object that specifies whether to include notifications for any SQL Server Agent alerts that in the script. 
Propriété publiqueMembre statiqueAllowSystemObjectsGets an object that specifies whether system objects can be scripted or not.
Propriété publiqueMembre statiqueAnsiFileGets an object that specifies whether the script uses multibyte characters and requires code page 1252 to evaluate characters meaning.
Propriété publiqueMembre statiqueAnsiPaddingGets 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.
Propriété publiqueMembre statiqueAppendToFileGets an object that specifies whether the script is appended to the end of the output file or overwrites it.
Propriété publiqueMembre statiqueBindingsGets 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.
Propriété publiqueMembre statiqueChangeTrackingGets the ChangeTracking property value.
Propriété publiqueMembre statiqueClusteredIndexesGets an object that specifies whether statements that define clustered indexes are included in the generated script.
Propriété publiqueMembre statiqueContinueScriptingOnErrorGets an object value that specifies whether the scripting operation continues after an error is encountered.
Propriété publiqueMembre statiqueConvertUserDefinedDataTypesToBaseTypeGets 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. 
Propriété publiqueMembre statiqueDdlBodyOnlyGets 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.
Propriété publiqueMembre statiqueDdlHeaderOnlyGets 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.
Propriété publiqueMembre statiqueDefaultGets an object value that specifies whether the creation of the referenced object is included in the generated script.
Propriété publiqueMembre statiqueDriAllGets an object value that specifies whether the DRI objects are included in the generated script.
Propriété publiqueMembre statiqueDriAllConstraintsGets an object value that specifies whether all DRI constraints are included in the generated script.
Propriété publiqueMembre statiqueDriAllKeysGets an object value that specifies whether all DRI keys (DriForeignKeys, DriPrimaryKey, DriUniqueKeys) are included in the generated script.
Propriété publiqueMembre statiqueDriChecksGets an object value that specifies whether column-specific dependency relationships defined in check constraints with enforced declarative referential integrity are included in the script.
Propriété publiqueMembre statiqueDriClusteredGets an object value that specifies whether dependency relationships defined in clustered indexes with enforced declarative referential integrity are included in the script.
Propriété publiqueMembre statiqueDriDefaultsGets an object value that specifies whether dependency relationships defined in defaults with enforced declarative referential integrity are included in the script.
Propriété publiqueMembre statiqueDriForeignKeysGets an object value that specifies whether dependency relationships defined in foreign keys with enforced declarative referential integrity are included in the script.
Propriété publiqueMembre statiqueDriIncludeSystemNamesGets an object value that specifies whether the system generated constraint names used to enforce declarative referential integrity are included in the script.
Propriété publiqueMembre statiqueDriIndexesGets 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.
Propriété publiqueMembre statiqueDriNonClusteredGets an object value that specifies whether dependency relationships defined in non-clustered indexes with enforced declarative referential integrity are included in the script.
Propriété publiqueMembre statiqueDriPrimaryKeyGets an object value that specifies whether dependency relationships defined in primary keys with enforced declarative referential integrity are included in the script.
Propriété publiqueMembre statiqueDriUniqueKeysGets an object value that specifies whether dependency relationships defined in unique keys with enforced declarative referential integrity are included in the script.
Propriété publiqueMembre statiqueDriWithNoCheckGets an object value that specifies whether the no check statement is included in the script.
Propriété publiqueMembre statiqueEnforceScriptingOptionsGets an object value that specifies whether the application of all scripting options is enforced for text base objects, such as SchemaQualify.
Propriété publiqueMembre statiqueExtendedPropertiesGets an object value that specifies whether extended object properties are included in the generated script.
Propriété publiqueMembre statiqueFullTextCatalogsGets an object value that specifies whether full-text catalogs are included in the generated script.
Propriété publiqueMembre statiqueFullTextIndexesGets an object value that specifies whether full-text indexes are included in the generated script.
Propriété publiqueMembre statiqueFullTextStopListsGets an object value that specifies whether full-text stop lists are included in the generated script.
Propriété publiqueMembre statiqueIncludeDatabaseContextGets an object value that specifies whether database content is included in the generated script.
Propriété publiqueMembre statiqueIncludeDatabaseRoleMembershipsGets the IncludeDatabaseRoleMemberships property value.
Propriété publiqueMembre statiqueIncludeFullTextCatalogRootPathGets the IncludeFullTextCatalogRootPath property value.
Propriété publiqueMembre statiqueIncludeHeadersGets an object that specifies whether the generated script is prefixed with a header containing information including the date and time of generation.
Propriété publiqueMembre statiqueIncludeIfNotExistsGets an object that specifies whether to check the existence of an object before including it in the script.
Propriété publiqueMembre statiqueIndexesGets an object that specifies whether indexes are included in the generated script.
Propriété publiqueMembre statiqueLoginSidGets or sets the Boolean property value that specifies whether the security identifiers are included for any scripted logins in the generated script.
Propriété publiqueMembre statiqueNoAssembliesGets an object that specifies whether assemblies are excluded from the generated script.
Propriété publiqueMembre statiqueNoCollationGets 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.
Propriété publiqueMembre statiqueNoCommandTerminatorGets an object value that specifies whether individual Transact-SQL statements are delimited in the generated script.
Propriété publiqueMembre statiqueNoExecuteAsGets an object value that specifies whether the EXECUTE AS options for stored procedures and user-defined functions are included in the script.
Propriété publiqueMembre statiqueNoFileGroupGets an object value that specifies whether to include the 'ON <filegroup>' clause in the generated script.
Propriété publiqueMembre statiqueNoFileStreamGets an object that specifies whether to include the FILESTREAM_ON clause when you create VarBinaryMax columns in the generated script.
Propriété publiqueMembre statiqueNoFileStreamColumnGets an object that specifies whether to include the FILESTREAM_ON clause when you create VarBinaryMax columns in the generated script.
Propriété publiqueMembre statiqueNoIdentitiesGets an object value that specifies whether definitions of identity property seed and increment are included in the generated script.
Propriété publiqueMembre statiqueNoIndexPartitioningSchemesGets an object value that specifies whether partition schemes for indexes are included in the generated script.
Propriété publiqueMembre statiqueNoMailProfileAccountsGets an object value that specifies whether mail accounts referenced by mail profiles are included in the generated script.
Propriété publiqueMembre statiqueNoMailProfilePrincipalsGets an object value that specifies whether principals referenced by mail profiles are excluded from the generated script.
Propriété publiqueMembre statiqueNonClusteredIndexesGets an object value that specifies whether non-clustered indexes are included in the generated script.
Propriété publiqueMembre statiqueNoTablePartitioningSchemesGets an object value that specifies whether partition schemes for tables are included in the generated script.
Propriété publiqueMembre statiqueNoVardecimalGets the NoVardecimal property value.
Propriété publiqueMembre statiqueNoViewColumnsGets an object value that specifies whether to include the specified columns for a view.
Propriété publiqueMembre statiqueNoXmlNamespacesGets an object value that specifies whether XML namespaces are included in the generated script.
Propriété publiqueMembre statiqueOptimizerDataGets an object value that specifies whether script optimizer data for the referenced objects are included in the generated script.
Propriété publiqueMembre statiquePermissionsGets an object value that specifies whether to all permissions in the generated script.
Propriété publiqueMembre statiquePrimaryObjectGets an object value that specifies whether the creation of the referenced object is included in the generated script.
Propriété publiqueMembre statiqueSchemaQualifyGets an object value that specifies whether the script contains object with no schema.
Propriété publiqueMembre statiqueSchemaQualifyForeignKeysReferencesGets an object value that specifies whether tables with no schema that are referenced by a foreign key are included in the generated script.
Propriété publiqueMembre statiqueScriptBatchTerminatorGets the batch terminator of the script option.
Propriété publiqueMembre statiqueScriptDataGets the ScriptData property value.
Propriété publiqueMembre statiqueScriptDataCompressionGets an object value that specifies whether the creation of the referenced object is included in the generated script.
Propriété publiqueMembre statiqueScriptOwnerGets an object value that specifies whether the creation of the referenced object is included in the generated script.
Propriété publiqueMembre statiqueScriptSchemaGets the schema of the script option.
Propriété publiqueMembre statiqueStatisticsGets an object value that specifies whether statistics are generated for any table or view included in the generated script.
Propriété publiqueMembre statiqueTimestampToBinaryGets 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.
Propriété publiqueMembre statiqueToFileOnlyGets an object value that specifies whether to output to file only or to generate string output too.
Propriété publiqueMembre statiqueTriggersGets an object value that specifies whether to include the definition for triggers in the generated script.
Propriété publiqueMembre statiqueWithDependenciesGets an object value that specifies whether to include all dependent objects in the generated script.
Propriété publiqueMembre statiqueXmlIndexesGets an object value that specifies whether XML indexes are included in the generated script.
Haut de la page
  NomDescription
Méthode publiqueMembre statiqueAddAdds the two ScriptOption objects to create a ScriptOptions object.
Méthode publiqueMembre statiqueBitwiseOrCombines two ScriptingOptions object using a Bitwise OR operation.
Méthode publiqueEqualsReturns a Boolean value that specifies if two ScriptOptions are equal. (remplace Object.Equals(Object).)
Méthode publiqueGetHashCodeReturns the hash code for this object. (remplace Object.GetHashCode().)
Méthode publiqueGetType (hérité de Object.)
Méthode publiqueToStringReturns a string that represents the current object. (remplace Object.ToString().)
Haut de la page
  NomDescription
Opérateur publicMembre statiqueAdditionCreates a set of scripting options by performing an addition operation on two ScriptOption objects.
Opérateur publicMembre statiqueBitwiseOrCreates a set of scripting options by performing a bitwise OR operation on two ScriptOption objects.
Opérateur publicMembre statiqueImplicit(ScriptOption to ScriptingOptions)Implicitly converts the specified ScriptOption to a ScriptingOptions object.
Haut de la page

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

Tout membre statique public (Partagé dans Microsoft Visual Basic) de ce type est sûr dans le cadre des opérations à plusieurs threads. Tous les membres de l'instance ne sont pas garantis comme étant thread-safe.

'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
Tous les membres publics static (Shared dans Visual Basic) de ce type sont thread-safe. Tous les membres de l'instance ne sont pas garantis comme étant thread-safe.
Cela vous a-t-il été utile ?
(1500 caractères restants)

Ajouts de la communauté

AJOUTER
© 2013 Microsoft. Tous droits réservés.