April 13, 2012

sp_adddatatypemapping (Transact-SQL MetaData) Definition

Please note: that the following source code is provided and copyrighted by Microsoft and is for educational purpose only.
The meta data is from an SQL 2012 Server.

I have posted alot more, find the whole list here.

Goto Definition or MetaData

Definition:

sys.sp_adddatatypemapping(nvarchar @source_dbms
, varchar @source_version
, nvarchar @source_type
, bigint @source_length_min
, bigint @source_length_max
, bigint @source_precision_min
, bigint @source_precision_max
, int @source_scale_min
, int @source_scale_max
, bit @source_nullable
, nvarchar @destination_dbms
, varchar @destination_version
, nvarchar @destination_type
, bigint @destination_length
, bigint @destination_precision
, int @destination_scale
, bit @destination_nullable
, int @destination_createparams
, bit @dataloss
, bit @is_default)

MetaData:

   
--
-- Name:
-- sp_adddatatypemapping
--
-- Description:
-- Add source/destination data type mapping
--
-- Returns:
-- 0 if successful
-- 1 if failed
--
-- Security:
-- public
--
-- Notes:
-- Implicitly will create a DBMS map if it doesn't
-- currently exist. DBMS types must exist before
-- adding a mapping. If no default currently
-- exists, this is set as the default mapping
--

CREATE PROCEDURE sys.sp_adddatatypemapping
(
@source_dbms sysname,
@source_version varchar(10) = NULL,
@source_type sysname,
@source_length_min bigint = NULL,
@source_length_max bigint = NULL,
@source_precision_min bigint = NULL,
@source_precision_max bigint = NULL,
@source_scale_min int = NULL,
@source_scale_max int = NULL,
@source_nullable bit = NULL,
@destination_dbms sysname,
@destination_version varchar(10) = NULL,
@destination_type sysname,
@destination_length bigint = NULL,
@destination_precision bigint = NULL,
@destination_scale int = NULL,
@destination_nullable bit = NULL,
@destination_createparams int = NULL,
@dataloss bit = 0,
@is_default bit = 0
)
AS
BEGIN
DECLARE @retcode int

-- Issue unsupported warning
RAISERROR(21769, 10, -1)

-- Do data type mapping
EXEC @retcode = sp_MSrepl_adddatatypemapping @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 = @destination_nullable,
@destination_createparams = @destination_createparams,
@dataloss = @dataloss,
@is_default = @is_default

RETURN @retcode
END

No comments:

Post a Comment

Total Pageviews