標示 Microsoft SQL Server 與非 SQL Server 資料庫管理系統 (DBMS) 之間的現有資料類型對應 (作為預設值)。
這個預存程序執行於任何資料庫中的散發者端。
Transact-SQL 語法慣例
sp_setdefaultdatatypemapping [ [ @mapping_id = ] mapping_id ]
[ , [ @source_dbms = ] 'source_dbms' ]
[ , [ @source_version = ] 'source_version' ]
[ , [ @source_type = ] '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 = ] 'destination_dbms' ]
[ , [ @destination_version = ] 'destination_version' ]
[ , [ @destination_type = ] 'destination_type' ]
[ , [ @destination_length = ] destination_length ]
[ , [ @destination_precision = ] destination_precision ]
[ , [ @destination_scale = ] destination_scale ]
[ , [ @destination_nullable = ] source_nullable ]
-
[ @mapping_id= ] mapping_id
-
識別現有的資料類型對應。
mapping_id 是 int,預設值為 NULL。 如果您指定 mapping_id,則不需要其餘的參數。
-
[ @source_dbms= ] 'source_dbms'
-
這是對應資料類型的來源 DBMS 名稱。
source_dbms 是 sysname,它可以是下列其中一個值。
|
值
|
說明
|
|
MSSQLSERVER
|
來源是一個 SQL Server 資料庫。
|
|
ORACLE
|
來源是一個 Oracle 資料庫。
|
|
NULL (預設值)
|
|
如果 mapping_id 是 NULL,您必須指定這個參數。
-
[ @source_version= ] 'source_version'
-
這是來源 DBMS 的版本號碼。
source_version 是 varchar(10),預設值是 NULL。
-
[ @source_type= ] 'source_type'
-
這是來源 DBMS 中的資料類型。
source_type 是 sysname。 如果 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_min 是 bigint,預設值是 NULL。
-
[ @source_scale_min= ] source_scale_min
-
這是來源 DBMS 中資料類型的最小小數位數。
source_scale_min 是 int,預設值是 NULL。
-
[ @source_scale_max= ] source_scale_max
-
這是來源 DBMS 中資料類型的最大小數位數。
source_scale_min 是 int,預設值是 NULL。
-
[ @source_nullable= ] source_nullable
-
這是指來源 DBMS 中的資料類型是否支援 NULL 值。
source_nullable 是 bit,預設值是 NULL。
1 表示支援 NULL 值。
-
[ @destination_dbms = ] 'destination_dbms'
-
這是目的地 DBMS 的名稱。
destination_dbms 是 sysname,它可以是下列值之一。
|
值
|
說明
|
|
MSSQLSERVER
|
目的地是一個 SQL Server 資料庫。
|
|
ORACLE
|
目的地是一個 Oracle 資料庫。
|
|
DB2
|
目的地是一個 IBM DB2 資料庫。
|
|
SYBASE
|
目的地是一個 Sybase 資料庫。
|
|
NULL (預設值)
|
|
-
[ @destination_version= ] 'destination_version'
-
這是目的地 DBMS 的產品版本。
destination_version 是 varchar(10),預設值是 NULL。
-
[ @destination_type= ] '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 值。
sp_setdefaultdatatypemapping 用於 SQL Server 與非 SQL Server DBMS 之間的所有複寫類型中。
預設資料類型對應套用至包含指定的 DBMS 之所有複寫拓撲。
只有系統管理員 (sysadmin) 固定伺服器角色的成員,才能夠執行 sp_setdefaultdatatypemapping。