Dec
10
Written by:
Steve Gray
12/10/2010 1:22 PM
This is part of the data access classes, look here for the overview
Code Snippet
- IF EXISTS (SELECT *
- FROM sysobjects
- WHERE name = N'f_4P_columnTypeVB')
- DROP FUNCTION f_4P_columnTypeVB
- GO
-
- CREATE FUNCTION f_4P_columnTypeVB
- (@intColumnType as int)
- --select dbo.f_4P_columnTypeVB(104)
-
- RETURNS varchar(30)
-
- AS
- BEGIN
- declare @out varchar(30)
-
- select @out =
- case
- when @intColumnType in(48) then 'Int16' /* tinyint */
- when @intColumnType in(52) then 'Int16' /* smallint */
- when @intColumnType in(56) then 'Int32' /* int */
- when @intColumnType in(127) then 'Int64' /* bigint */
- when @intColumnType = 104 then 'Boolean' /* bit */
- when @intColumnType = 36 then 'GUID'
- when @intColumnType in (108,60,63,106,62) then 'Double'
- when @intColumnType in (104, 45) then 'Boolean'
- when @intColumnType in (35,47,167, 175, 231,239) then 'String'
- when @intColumnType = 61 then 'Date'
- WHEN @intColumnType = 173 THEN 'Byte()' /* binary */
- WHEN @intColumnType = 189 THEN 'Byte()' /* timestamp */
- else 'Dunno - ' + convert(varchar(4),@intColumnType)
- end
-
- return @out
-
- END
- GO
- --sp_help sop10200
As always, I welcome your comments!