sp_setdefaultdatatypemapping (Transact-SQL)
適用対象: SQL Server
SQL Server と SQL Server 以外のデータベース管理システム (DBMS) の間の既存のデータ型マッピングを既定としてマークします。 このストアド プロシージャは、任意のデータベースのディストリビューターで実行されます。
構文
sp_setdefaultdatatypemapping
[ [ @mapping_id = ] mapping_id ]
[ , [ @source_dbms = ] N'source_dbms' ]
[ , [ @source_version = ] 'source_version' ]
[ , [ @source_type = ] N'source_type' ]
[ , [ @source_length_min = ] source_length_min ]
[ , [ @source_length_max = ] source_length_max ]
[ , [ @source_precision_min = ] source_precision_min ]
[ , [ @source_precision_max = ] source_precision_max ]
[ , [ @source_scale_min = ] source_scale_min ]
[ , [ @source_scale_max = ] source_scale_max ]
[ , [ @source_nullable = ] source_nullable ]
[ , [ @destination_dbms = ] N'destination_dbms' ]
[ , [ @destination_version = ] 'destination_version' ]
[ , [ @destination_type = ] N'destination_type' ]
[ , [ @destination_length = ] destination_length ]
[ , [ @destination_precision = ] destination_precision ]
[ , [ @destination_scale = ] destination_scale ]
[ , [ @destination_nullable = ] destination_nullable ]
[ ; ]
引数
[ @mapping_id = ] mapping_id
既存のデータ型マッピングを識別します。 @mapping_id は int で、既定値は NULL
です。 @mapping_idを指定した場合、残りのパラメーターは必要ありません。
[ @source_dbms = ] N'source_dbms'
データ型のマップ元となる DBMS の名前。 @source_dbms は sysname で、次のいずれかの値を指定できます。
Value | 説明 |
---|---|
MSSQLSERVER |
ソースは SQL Server データベースです。 |
ORACLE |
マップ元は Oracle データベース。 |
NULL (既定) |
@mapping_idがNULL
場合は、このパラメーターを指定する必要があります。
[ @source_version = ] 'source_version'
ソース DBMS のバージョン番号。 @source_version は varchar(10) で、既定値は NULL
です。
[ @source_type = ] N'source_type'
ソース DBMS のデータ型。 @source_type は sysname で、既定値は NULL
です。 mapping_idがNULL
場合は、このパラメーターを指定する必要があります。
[ @source_length_min = ] source_length_min
ソース DBMS のデータ型の最小長。 @source_length_min は bigint で、既定値は NULL
です。
[ @source_length_max = ] source_length_max
ソース DBMS のデータ型の最大長。 @source_length_max は bigint で、既定値は NULL
です。
[ @source_precision_min = ] source_precision_min
ソース DBMS のデータ型の最小有効桁数。 @source_precision_min は bigint で、既定値は NULL
です。
[ @source_precision_max = ] source_precision_max
ソース DBMS のデータ型の最大有効桁数。 @source_precision_max は bigint で、既定値は NULL
です。
[ @source_scale_min = ] source_scale_min
ソース DBMS のデータ型の最小スケール。 @source_scale_min は int で、既定値は NULL
です。
[ @source_scale_max = ] source_scale_max
ソース DBMS のデータ型の最大スケール。 @source_scale_max は int で、既定値は NULL
です。
[ @source_nullable = ] source_nullable
ソース DBMS のデータ型が NULL
の値をサポートするかどうかを指定します。 @source_nullable は ビットで、既定値は NULL
です。 1
は、 NULL
値がサポートされていることを意味します。
[ @destination_dbms = ] N'destination_dbms'
宛先 DBMS の名前。 @destination_dbms は sysname で、次のいずれかの値を指定できます。
Value | 説明 |
---|---|
MSSQLSERVER |
変換先は SQL Server データベースです。 |
ORACLE |
変換先は Oracle データベースです。 |
DB2 |
宛先は IBM Db2 データベースです。 |
SYBASE |
変換先は Sybase データベースです。 |
NULL (既定) |
[ @destination_version = ] 'destination_version'
マップ先 DBMS の製品バージョンです。 @destination_version は varchar(10) で、既定値は NULL
です。
[ @destination_type = ] N'destination_type'
宛先 DBMS に一覧表示されているデータ型。 @destination_type は sysname で、既定値は NULL
です。
[ @destination_length = ] destination_length
マップ先 DBMS のデータ型の長さです。 @destination_length は bigint で、既定値は NULL
です。
[ @destination_precision = ] destination_precision
宛先 DBMS のデータ型の有効桁数。 @destination_precision は bigint で、既定値は NULL
です。
[ @destination_scale = ] destination_scale
マップ先 DBMS のデータ型の小数点以下桁数です。 @destination_scale は int で、既定値は NULL
です。
[ @destination_nullable = ] destination_nullable
宛先 DBMS のデータ型が NULL
の値をサポートするかどうかを指定します。 @destination_nullable は bit で、既定値は NULL
です。 1
は、 NULL
値がサポートされていることを意味します。
リターン コードの値
0
(成功) または 1
(失敗)。
解説
sp_setdefaultdatatypemapping
は、SQL Server と SQL Server 以外の DBMS 間のすべての種類のレプリケーションで使用されます。
既定のデータ型マッピングは、指定した DBMS を含むすべてのレプリケーション トポロジに適用されます。
アクセス許可
sysadmin固定サーバー ロールのメンバーのみがsp_setdefaultdatatypemapping
を実行できます。