You are here: Re: How to convert from CHAR to Numeric in the table « MsSQL Server « IT news, forums, messages
Re: How to convert from CHAR to Numeric in the table

Posted by Tibor Karaszi on 09/29/05 17:34

If you don't have any dirty data, you can do:

UPDATE tblname
SET invamt2 = CAST(invamt AS numeric(..., ...))

If you do have dirty data, you will get a datatype conversion error from above and need to clean
your data first.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/


"Mac" <mac@hotmail.com> wrote in message news:TSS_e.10727$WT3.7999@trnddc03...
>
> I have imported some data to sql2k from my old system. Somehow, it imported invoice amount to
> char type.
>
> I just created another column called invamt2 type NUMERIC so I can copy or convert content of
> invamt which is type CHAR. There are about 50,000 records.
>
> How can I convert/cast from char type to numeric type ?
>
> Thanks
>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация