Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_getdefaultdatatypemapping

  No additional text.


Syntax


-- Name:
--		sp_getdefaultdatatypemapping

-- Description:
--		Retrieve default data type for specified parameters

-- Returns:
--		0 if successful
--		1 if failed

-- Security:
--		Public

-- Notes:
--		


create procedure sys.sp_getdefaultdatatypemapping
(
	@source_dbms			sysname,
	@source_version			varchar(10) = NULL,
	@source_type			sysname,
	@source_length			bigint = NULL,
	@source_precision		int = NULL,
	@source_scale			int = NULL,
	@source_nullable		bit = 1,
	@destination_dbms		sysname,
	@destination_version	varchar(10) = NULL,
	@destination_type		sysname OUTPUT,
	@destination_length		bigint OUTPUT,
	@destination_precision	int OUTPUT,
	@destination_scale		int OUTPUT,
	@destination_nullable	bit OUTPUT,
	@dataloss				bit OUTPUT
)
as
BEGIN
	DECLARE @retcode int
	SET @retcode = 0

	
    -- Security Check: require sysadmin
	
    IF (ISNULL(IS_SRVROLEMEMBER('sysadmin'),0) = 0)
    BEGIN
        RAISERROR(21089,16,-1)
        RETURN (1)
    END


	-- Check if type even exists
	IF (sys.fn_MSrepl_checktype(@source_type, @source_dbms, @source_version) = 0)
	BEGIN
		RAISERROR(21654, 16, -1, @source_type)
		RETURN (1)
	END
	
	SELECT	@destination_type		= destination_type,
			@destination_length		= destination_length,
			@destination_precision	= destination_precision,
			@destination_scale		= destination_scale,
			@destination_nullable	= destination_nullable,
			@dataloss				= dataloss
	FROM	sys.fn_MSrepl_getdatatypemappings
			(
				@source_dbms,
				@source_version,
				@source_type,
				@source_length,
				@source_precision,
				@source_scale,
				@source_nullable,
				@destination_dbms,
				@destination_version,
				1,
				NULL
			)
			
	IF @@ROWCOUNT = 0
	BEGIN
		RAISERROR (21656, 16, -1, @source_type)
		RETURN (1)
	END

	RETURN (0)
END

 
Last revision 2008RTM
See also

  sp_MSdrop_replcom (Procedure)
sp_MSrepl_changearticlecolumndatatype (Procedure)
       



News

  Query a named instance
Sybase+ASE+silent+install
SQL 2008 R2
Deprecated procedures in SQL2008
Reporting Services item-level role definitions
Create all your missing indexes
Converting datetime field
Start MSSQL Server Profiler at time
Replicating MSSQL Server views
Exploring Microsoft Sharepoint
The OLE DB provider "SQLNCLI10" for linked server indicates.
Mobile solar charger
Oracle to SQL Server replication
Cannot insert the value NULL into column
Undocumented Microsoft SQL Server 2008
VMware
Zoekmachine optimalisatie
SQL Servers hidden objects
FckEditor
Flash in Ajax
De hype die AJAX heet
Barcode scannen
MySQL; Gratis, makkelijk en snel!
PHP
sIFR; de combinatie tussen HTML en Flash