Click here to Skip to main content
15,915,328 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
SQL
declare @Que nvarchar(max),@MonthNm nvarchar(50),@UpdateMonth decimal(18,2)
set @MonthNm='July'
set @UpdateMonth=1500


set @Que ='update INCENTIVE.dbo.Direct_Summary_Policies set '+@MonthNm+'='+@UpdateMonth
print @Que

it giver error:
Arithmetic overflow error converting nvarchar to data type numeric.

How to resolve ?
Posted
Updated 1-Jul-14 19:45pm
v5
Comments
syed shanu 2-Jul-14 1:40am    
Improve your question you didnt use @SQL just declared id prived your full query so that we can check whats wrong.

Try:
SQL
set @Que ='update INCENTIVE.dbo.Direct_Summary_Policies set '+@MonthNm+'='+CONVERT(NVARCHAR(10),@UpdateMonth)
 
Share this answer
 
Hi,

Not clear about, what exactly you want to say. But seeing your error...

Try this one..

SQL
set @Que ='UPDATE INCENTIVE.dbo.Direct_Summary_Policies SET ' + @MonthNm + ' = ' + CONVERT(VARCHAR,@UpdateMonth) + '''

Print (@Que)



Hope this will help you.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900