次の方法で共有


DTSBulkInsert_DataFileType 列挙体

ソース データを提供するファイルの種類を定義します。

名前空間:  Microsoft.SqlServer.Dts.Tasks.BulkInsertTask
アセンブリ:  Microsoft.SqlServer.BulkInsertTask (Microsoft.SqlServer.BulkInsertTask.dll)

構文

'宣言
Public Enumeration DTSBulkInsert_DataFileType
'使用
Dim instance As DTSBulkInsert_DataFileType
public enum DTSBulkInsert_DataFileType
public enum class DTSBulkInsert_DataFileType
type DTSBulkInsert_DataFileType
public enum DTSBulkInsert_DataFileType

メンバー

メンバー名 説明
DTSBulkInsert_DataFileType_Char 文字形式です (既定値)。
DTSBulkInsert_DataFileType_Native ネイティブ (データベース) データ型です。bcp ユーティリティを使用して SQL Server からデータを一括コピーし、ネイティブ データ ファイルを作成します。

widenative 型の値を使用すると、char データ型よりも高いパフォーマンスが得られます。

DTSBulkInsert_DataFileType_WideChar Unicode 文字です。
DTSBulkInsert_DataFileType_WideNative データを Unicode で格納する、char、varchar、および text 列以外のネイティブ (データベース) データ型です。bcp ユーティリティを使用して SQL Server からデータを一括コピーし、widenative のデータ ファイルを作成します。

widenative を使用すると、widechar よりも高いパフォーマンスが得られます。 ANSI 拡張文字を含んだデータ ファイルの場合は、widenative を指定します。

説明

一括挿入タスクは、大量のデータを SQL Server のテーブルまたはビューにコピーする最も速い方法です。 詳細については、「一括挿入タスク」および「bcp ユーティリティ」を参照してください。

使用例

次の例では、まず BulkInsertTask を作成し、次に TaskHost を使用して既定の設定を表示します。 次に、フィールドに値を設定する方法を示すため、この列挙を使用する DataFileType を含む 2 つのフィールドを設定します。

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SqlServer.Dts.Runtime;
using Microsoft.SqlServer.Dts.Tasks.BulkInsertTask;

namespace Microsoft.SqlServer.SSIS.Samples
{
    class Program
    {
        static void Main(string[] args)
        {
            Package pkg = new Package();
            Executable exec1 = pkg.Executables.Add("STOCK:BulkInsertTask");
            TaskHost th = exec1 as TaskHost;

            // List the default values of the Bulk Insert task
            // using the Properties collection of the TaskHost.
            Console.WriteLine("BatchSize             {0}", th.Properties["BatchSize"].GetValue(th));
            Console.WriteLine("CheckConstraints      {0}", th.Properties["CheckConstraints"].GetValue(th));
            Console.WriteLine("CodePage              {0}", th.Properties["CodePage"].GetValue(th));
            Console.WriteLine("DataFileType          {0}", th.Properties["DataFileType"].GetValue(th));
            Console.WriteLine("DebugMode             {0}", th.Properties["DebugMode"].GetValue(th));
            Console.WriteLine("DestinationConnection {0}", th.Properties["DestinationConnection"].GetValue(th));
            Console.WriteLine("DestinationTableName  {0}", th.Properties["DestinationTableName"].GetValue(th));
            Console.WriteLine("FieldTerminator       {0}", th.Properties["FieldTerminator"].GetValue(th));
            Console.WriteLine("FireTriggers          {0}", th.Properties["FireTriggers"].GetValue(th));
            Console.WriteLine("FirstRow              {0}", th.Properties["FirstRow"].GetValue(th));
            Console.WriteLine("FormatFile            {0}", th.Properties["FormatFile"].GetValue(th));
            Console.WriteLine("KeepIdentity          {0}", th.Properties["KeepIdentity"].GetValue(th));
            Console.WriteLine("KeepNulls             {0}", th.Properties["KeepNulls"].GetValue(th));
            Console.WriteLine("LastRow               {0}", th.Properties["LastRow"].GetValue(th));
            Console.WriteLine("RowTerminator         {0}", th.Properties["RowTerminator"].GetValue(th));
            Console.WriteLine("SortedData            {0}", th.Properties["SortedData"].GetValue(th));
            Console.WriteLine("SourceConnection      {0}", th.Properties["SourceConnection"].GetValue(th));
            Console.WriteLine("SqlStatement          {0}", th.Properties["SqlStatement"].GetValue(th));
            Console.WriteLine("SuspendRequired       {0}", th.Properties["SuspendRequired"].GetValue(th));
            Console.WriteLine("TableLock             {0}", th.Properties["TableLock"].GetValue(th));
            Console.WriteLine("UseFormatFile         {0}", th.Properties["UseFormatFile"].GetValue(th));

            Console.WriteLine("--------------------------");
            // Show how to set a property using the TaskHost Properties.
            th.Properties["CheckConstraints"].SetValue(th, true);
            th.Properties["DataFileType"].SetValue(th, DTSBulkInsert_DataFileType.DTSBulkInsert_DataFileType_Native);
            Console.WriteLine("New value of CheckConstraints and DataFileType:  {0}, {1}", th.Properties["CheckConstraints"].GetValue(th), th.Properties["DataFileType"].GetValue(th));
        }
    }
}
Imports System
Imports System.Collections.Generic
Imports System.Text
Imports Microsoft.SqlServer.Dts.Runtime
Imports Microsoft.SqlServer.Dts.Tasks.BulkInsertTask
 
Namespace Microsoft.SqlServer.SSIS.Samples
    Class Program
        Shared  Sub Main(ByVal args() As String)
            Dim pkg As Package =  New Package() 
            Dim exec1 As Executable =  pkg.Executables.Add("STOCK:BulkInsertTask") 
            Dim th As TaskHost =  exec1 as TaskHost 
 
            ' List the default values of the Bulk Insert task
            ' using the Properties collection of the TaskHost.
            Console.WriteLine("BatchSize             {0}", th.Properties("BatchSize").GetValue(th))
            Console.WriteLine("CheckConstraints      {0}", th.Properties("CheckConstraints").GetValue(th))
            Console.WriteLine("CodePage              {0}", th.Properties("CodePage").GetValue(th))
            Console.WriteLine("DataFileType          {0}", th.Properties("DataFileType").GetValue(th))
            Console.WriteLine("DebugMode             {0}", th.Properties("DebugMode").GetValue(th))
            Console.WriteLine("DestinationConnection {0}", th.Properties("DestinationConnection").GetValue(th))
            Console.WriteLine("DestinationTableName  {0}", th.Properties("DestinationTableName").GetValue(th))
            Console.WriteLine("FieldTerminator       {0}", th.Properties("FieldTerminator").GetValue(th))
            Console.WriteLine("FireTriggers          {0}", th.Properties("FireTriggers").GetValue(th))
            Console.WriteLine("FirstRow              {0}", th.Properties("FirstRow").GetValue(th))
            Console.WriteLine("FormatFile            {0}", th.Properties("FormatFile").GetValue(th))
            Console.WriteLine("KeepIdentity          {0}", th.Properties("KeepIdentity").GetValue(th))
            Console.WriteLine("KeepNulls             {0}", th.Properties("KeepNulls").GetValue(th))
            Console.WriteLine("LastRow               {0}", th.Properties("LastRow").GetValue(th))
            Console.WriteLine("RowTerminator         {0}", th.Properties("RowTerminator").GetValue(th))
            Console.WriteLine("SortedData            {0}", th.Properties("SortedData").GetValue(th))
            Console.WriteLine("SourceConnection      {0}", th.Properties("SourceConnection").GetValue(th))
            Console.WriteLine("SqlStatement          {0}", th.Properties("SqlStatement").GetValue(th))
            Console.WriteLine("SuspendRequired       {0}", th.Properties("SuspendRequired").GetValue(th))
            Console.WriteLine("TableLock             {0}", th.Properties("TableLock").GetValue(th))
            Console.WriteLine("UseFormatFile         {0}", th.Properties("UseFormatFile").GetValue(th))
 
            Console.WriteLine("--------------------------")
            ' Show how to set a property using the TaskHost Properties.
            th.Properties("CheckConstraints").SetValue(th, True)
            th.Properties("DataFileType").SetValue(th, DTSBulkInsert_DataFileType.DTSBulkInsert_DataFileType_Native)
            Console.WriteLine("New value of CheckConstraints and DataFileType:  {0}, {1}", th.Properties("CheckConstraints").GetValue(th), th.Properties("DataFileType").GetValue(th))
 
        End Sub
    End Class
End Namespace

サンプル出力 :

BatchSize 0

CheckConstraints False

CodePage RAW

DataFileType 0

DebugMode False

DestinationConnection

DestinationTableName

FieldTerminator Tab

FireTriggers False

FirstRow 1

FormatFile

KeepIdentity False

KeepNulls False

LastRow 0

MaximumErrors 0

RowTerminator {CR}{LF}

SortedData

SourceConnection

SqlStatement System.String[]

SuspendRequired False

TableLock False

UseFormatFile False

--------------------------

New value of CheckConstraints and DataFileType: True, 1

関連項目

参照

Microsoft.SqlServer.Dts.Tasks.BulkInsertTask 名前空間