SQL Server Performance Forum – Threads Archive
String to moneyHi , 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. —
Microsoft SQL Server MVP
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.