sp_setdefaultdatatypemapping (Transact-SQL)

将 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_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 = ] '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 值。

返回代码值

0(成功)或 1(失败)

备注

sp_setdefaultdatatypemapping 用于 SQL Server 与非 SQL Server DBMS 之间的所有复制类型。

默认数据类型映射适用于所有包含指定 DBMS 的复制拓扑。

权限

只有 sysadmin 固定服务器角色的成员才能执行 sp_setdefaultdatatypemapping

请参阅

参考

sp_getdefaultdatatypemapping (Transact-SQL)
sp_helpdatatypemap (Transact-SQL)

其他资源

How to: Specify Data Type Mappings for an Oracle Publisher (Replication Transact-SQL Programming)

帮助和信息

获取 SQL Server 2005 帮助