Riddhi Valecha

Riddhi Valecha

  • 442
  • 3.3k
  • 415.2k

Arithmetic overflow -converting varchar to data type numeric

Feb 16 2015 3:57 AM
Hi all..

Please Help...

I am facing errors in executing stored procedure.

My Procedure is -

Procedure  MyTestProcedure

@Value numeric(18,0)

Declare @SQLQuery as varchar(max)

set @SQLQuery ='select * from (select ROW_NUMBER() over (order by Table1.ID desc) as ROW,
  Table1.ID  as ID,
  Table1.EmpName, Table1.Phone, Table1.Email,
Table1.Address,  Table1.createdOn
  from Table1  ) as TableRows where 1=1 '


if @Value is not null
set @SQLQuery =  @SQLQuery + ' and TableRows.ID = '''+@Value+''''

----------

Error - Arithmetic overflow error converting varchar to data type numeric.
---
I am passing interger values (1,2) for variable @Value.

Please help !!

Answers (1)