Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Update script Error

Author  Topic 

luismgh
Starting Member

5 Posts

Posted - 2011-04-08 : 11:34:39
Hi there!

I'm trying to make a simple update:

UPDATE [Colheitas].[dbo].[CLH_SINISTRO]
SET [DespesaProcessada] = '290,40'
WHERE [NumeroSinistro] = 4744 and [SeguradoId] = 4637

Error:

Msg 8114, Level 16, State 5, Line 1
Error converting data type varchar to numeric.

the columns format is:

[DespesaProcessada] = decimal 13,2, null
[NumeroSinistro] = int, not null
[SeguradoId] = FK, int, not null

Any help is appreciated.

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2011-04-08 : 11:57:17
Column DespesaProcessada does not like the comma's that is in "290,40". Don't know if SQL accepts culture-sensitive decimal separators, http://weblogs.sqlteam.com/mladenp/archive/2006/10/24/15172.aspx seems to indicate that it does not. In any case, try this to see if that would do it:
UPDATE [Colheitas].[dbo].[CLH_SINISTRO]
SET [DespesaProcessada] = '290.40',
WHERE [NumeroSinistro] = 4744 and [SeguradoId] = 4637

Almost invisible, but I replaced "290,40" with "290.40".
Go to Top of Page

luismgh
Starting Member

5 Posts

Posted - 2011-04-08 : 12:08:31
quote:
Originally posted by sunitabeck

Column DespesaProcessada does not like the comma's that is in "290,40". Don't know if SQL accepts culture-sensitive decimal separators, http://weblogs.sqlteam.com/mladenp/archive/2006/10/24/15172.aspx seems to indicate that it does not. In any case, try this to see if that would do it:
UPDATE [Colheitas].[dbo].[CLH_SINISTRO]
SET [DespesaProcessada] = '290.40',
WHERE [NumeroSinistro] = 4744 and [SeguradoId] = 4637

Almost invisible, but I replaced "290,40" with "290.40".



I will try!
Thanks!
Go to Top of Page

luismgh
Starting Member

5 Posts

Posted - 2011-04-14 : 12:14:36
quote:
Originally posted by sunitabeck

Column DespesaProcessada does not like the comma's that is in "290,40". Don't know if SQL accepts culture-sensitive decimal separators, http://weblogs.sqlteam.com/mladenp/archive/2006/10/24/15172.aspx seems to indicate that it does not. In any case, try this to see if that would do it:
UPDATE [Colheitas].[dbo].[CLH_SINISTRO]
SET [DespesaProcessada] = '290.40',
WHERE [NumeroSinistro] = 4744 and [SeguradoId] = 4637

Almost invisible, but I replaced "290,40" with "290.40".



It worked!
Thank you for your help!
Go to Top of Page
   

- Advertisement -