Home Forums SQL Server 2008 T-SQL (SS2K8) 'Arithmetic overflow error converting numeric to data type numeric' RE: 'Arithmetic overflow error converting numeric to data type numeric'

  • ananda.murugesan (9/17/2012)


    please find the attached sample data for header and detail table

    CREATE FUNCTION [dbo].[GetDataType] ( @Table varchar(50), @fld varchar(50) )

    RETURNS varchar(1)

    AS

    BEGIN

    Declare @datatype varchar(1)

    select @datatype = case when xtype in ( 35, 175, 167 ) then 'C'

    when xtype in ( 61 ) then 'D'

    when xtype in ( 108, 62, 56, 52, 48 ) then 'N'

    else 'X' end

    from syscolumns

    where id = object_id(@Table)

    and name = @fld

    if @@rowcount = 0

    select @datatype = 'X'

    Return @datatype

    END

    thanks

    No attachments please. Provide some INSERT statements.

    :exclamation: "Be brave. Take risks. Nothing can substitute experience." :exclamation: