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.
| Author |
Topic |
|
claire99
Starting Member
17 Posts |
Posted - 2003-03-31 : 10:39:31
|
| I'd like to convert a char value to a money datatype. How to do it using convert or other ways? Thanks in advance!-------------------"And we know that all things work together for good to them that love God, to them who are the called according to his purpose." --- Roman 8:28 |
|
|
SamC
White Water Yakist
3467 Posts |
Posted - 2003-03-31 : 10:55:01
|
| CAST ('1.25' AS MONEY)Look up CAST and datatypes in BOL.Sam |
 |
|
|
claire99
Starting Member
17 Posts |
Posted - 2003-03-31 : 11:17:29
|
| I was trying "convert (money, PrintAmt)" and "cast(PrintAmt as money" but I got the same error message below in sql server: "Cannot convert a char value to money. The char value has incorrect syntax." The datatype of PrintAmt is nvarchar(9) Any idea what's the problem? Thanks!-------------------"And we know that all things work together for good to them that love God, to them who are the called according to his purpose." --- Roman 8:28 |
 |
|
|
samsekar
Constraint Violating Yak Guru
437 Posts |
Posted - 2003-03-31 : 23:53:10
|
| Use ISNUMERIC Function to find any invalid charectors.SELECT * from TableName where ISNUMERIC(PrintAmt)=0BOL Says..ISNUMERIC returns 1 when the input expression evaluates to a valid integer, floating point number, money or decimal type; otherwise it returns 0. A return value of 1 guarantees that expression can be converted to one of these numeric types.Sekar~~~~Success is not a destination that you ever reach. Success is the quality of your journey. |
 |
|
|
|
|
|