IF EXISTS (SELECT *
FROM sysobjects
WHERE name = N'ddf_columnTypeVB')
DROP FUNCTION ddf_columnTypeVB
GO
CREATE FUNCTION ddf_columnTypeVB
(@ColumnType as varchar(255))
--select dbo.ddf_columnTypeVB('decimal')
--sp_sps
RETURNS varchar(30)
AS
BEGIN
declare @out varchar(30)
select @out =
case
when @ColumnType in('tinyint') then 'Int16' /* tinyint */
when @ColumnType in('smallint') then 'Int16' /* smallint */
when @ColumnType in('int') then 'Int32' /* int */
when @ColumnType in('bigint') then 'Int64' /* bigint */
when @ColumnType = 'bit' then 'Boolean' /* bit */
when @ColumnType = 'uniqueidentifier' then 'GUID'
when @ColumnType in ('numeric','float','money','decimal','x') then 'Decimal'
when @ColumnType in ('bit', '') then 'Boolean'
when @ColumnType in ('varchar','nvarchar','char', 'nchar', 'text','') then 'String'
when @ColumnType in ('datetime') then 'DateTime'
when @ColumnType in ('date') then 'Date'
when @ColumnType in ('time') then 'DateTime' /* time */
WHEN @ColumnType = 'binary' THEN 'Byte()' /* binary */
WHEN @ColumnType = 'timestamp' THEN 'Byte()' /* timestamp */
else 'DUnno - ' + convert(varchar(20),@ColumnType)
end
return @out
END
GO
--sp_help sop10200