/****** Object: UserDefinedFunction [dbo].[funcGetCLRTypeBySqlType] Script Date: 03/23/2010 15:25:09 ******/
IF EXISTS (SELECT * FROM sys.objects
WHERE object_id = OBJECT_ID(N'[dbo].[funcGetCLRTypeBySqlType]')
AND type in (N'FN', N'IF', N'TF', N'FS', N'FT'))
DROP FUNCTION [dbo].[funcGetCLRTypeBySqlType]
GO
/****** Object: UserDefinedFunction [dbo].[funcGetCLRTypeBySqlType]
Script Date: 03/23/2010 15:25:09 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE FUNCTION [dbo].[funcGetCLRTypeBySqlType](
@SqlType [nvarchar] (200)
)
RETURNS [varchar](200) WITH EXECUTE AS CALLER
AS
BEGIN
declare @ClrType varchar(200)
--EXEC PROCuTILS_rOWcOLS 'DbVsCSharpTypes'
SET @ClrType = ( SELECT TOP 1 CSharpDataType FROM DbVsCSharpTypes
WHERE Sql2008DataType= @SqlType)
-- Return the result of the function
RETURN @ClrType
END
/*
<doc>Used for automatic conversation between tsql and C# types </doc>
*/
GO
/*
select dbo.funcGetCLRTypeBySqlType('varchar')
*/
No comments:
Post a Comment
- the first minus - Comments have to be moderated because of the spammers
- the second minus - I am very lazy at moderating comments ... hardly find time ...
- the third minus - Short links are no good for security ...
- The REAL PLUS : Any critic and positive feedback is better than none, so your comments will be published sooner or later !!!!