String to money | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

String to money

Hi , help me please..
i have table with column datatype money. In procedure i read some xml file , some value is string. I need write this value to table , to column with datatype money . What is the way ?
Same problem is with datetime. More important is converting and writing to money. Thanks , Lubo
Have you tried the CAST and CONVERT functions? Check "Books Online" for details.
Please post sample data! I guess you’re trying to insert a formatted string into a MONEY column, right? Beware of the pitfall that you have to use US currency convention. That is the decimal separator is the ‘.’ not the ‘,’ as we Europeans are used to. See if this works
SELECT CAST(REPLACE(REPLACE(< your values >,’.’,”),’,’,’.’) AS MONEY) Likewise for DATEs. The safest method is to rearrange to YYYYMMDD format and use this to INSERT. —
Frank Kalis
Microsoft SQL Server MVP
http://www.insidesql.de
Heute schon gebloggt?http://www.insidesql.de/blogs
Ich unterstütze PASS Deutschland e.V. http://www.sqlpass.de)

Adrian, I have tried it but I was wrong.
]]>