The Script method generates a Transact-SQL command batch that defines an existing SQL Server component. Some SQL-DMO objects, such as the Index object, support command batch generation for SQL-DMO objects that defines new components through the GenerateSQL method.
Use the GenerateSQL method when capturing object definition. Use the Script method when capturing an image of an exiting component. When using the Script method as part of an application process re-creating a component, specify SQLDMOScript_Drops in the ScriptType argument to include a drop of the existing component in the command batch.
附註: |
|---|
|
SQL-DMO object scripting methods are fully compatible with an instance of SQL Server version 7.0. However, database compatibility level affects Transact-SQL command batch contents.
|
When scripting a database with a compatibility level of less than 7.0, or when scripting any of its objects, the resulting Transact-SQL command batch includes only keywords reserved by that level.
Transact-SQL command syntax is always compliant with an instance of SQL Server 7.0. Where provided, you can use optional scripting arguments, such as SQLDMOScript2_NoFG to remove some syntax of an instance of SQL Server 7.0.