次の方法で共有


ScriptingOptions Class

ScriptingOptions オブジェクトを使用すると、スクリプト作成操作でオプションを設定する場合に、プログラム可能なオプションが利用できます。

名前空間: Microsoft.SqlServer.Management.Smo
アセンブリ: Microsoft.SqlServer.Smo (microsoft.sqlserver.smo.dll 内)

構文

'宣言
<DefaultMemberAttribute("Item")> _
Public NotInheritable Class ScriptingOptions
[DefaultMemberAttribute("Item")] 
public sealed class ScriptingOptions
[DefaultMemberAttribute(L"Item")] 
public ref class ScriptingOptions sealed
/** @attribute DefaultMemberAttribute("Item") */ 
public final class ScriptingOptions
DefaultMemberAttribute("Item") 
public final class ScriptingOptions

解説

更新されたテキスト :

警告 : 使用するスクリプト作成オプションによっては、対象サーバーで実行されないスクリプトが Transfer オブジェクトによって生成されることもあります。

この名前空間、クラス、またはメンバは、Microsoft .NET Framework Version 2.0 でのみサポートされています。

継承階層

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

使用例

'Connect to the local, default instance of SQL Server.
Dim srv As Server
srv = New Server
'Reference the AdventureWorks database.
Dim db As Database
db = srv.Databases("AdventureWorks")
'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

スレッド セーフ

この型の public static (Microsoft Visual Basic では共有 ) メンバは、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。

プラットフォーム

開発プラットフォーム

サポートされているプラットフォームの一覧については、「SQL Server 2005 のインストールに必要なハードウェアおよびソフトウェア」を参照してください。

対象プラットフォーム

サポートされているプラットフォームの一覧については、「SQL Server 2005 のインストールに必要なハードウェアおよびソフトウェア」を参照してください。

参照

関連項目

ScriptingOptions Members
Microsoft.SqlServer.Management.Smo Namespace

その他の技術情報

Visual Basic .NET でデータベースの依存関係のスクリプトを作成する方法
スクリプト

変更履歴

リリース

履歴

変更内容 :
  • IncludeDatabaseRoleMembers プロパティを追加しました。

  • NoVardecimal プロパティを追加しました。

変更内容 :
  • PrimaryObject プロパティの説明を変更しました。

  • Default プロパティの説明を変更しました。

  • 「例」セクションにコード例を追加しました。