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,而且可以是下列其中一個值。
值 | Description |
---|---|
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為 bit,預設值為 NULL
。 1
表示 NULL
支援值。
[ @destination_dbms = ] N'destination_dbms'
目的地 DBMS 的名稱。 @destination_dbms為 sysname,而且可以是下列其中一個值。
值 | Description |
---|---|
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 的所有複寫拓撲。
權限
只有系統管理員固定伺服器角色的成員才能執行 sp_setdefaultdatatypemapping
。
相關內容
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應