Documentation for T-SQL says that the conversion from varchar to money is implicit ( see chart about 1/3 down the page).
But, when I try inserting into a money column like this:
(where somemoney is a string. e.g., 38.25)
I get this error:
Disallowed implicit conversion from data type varchar to data type money, table 'myTable', column 'myMoney'. Use the CONVERT function to run this query.
But this works:
Is the documentation wrong or is my understanding wrong? Or, is the conversion implicit only in certain circumstances?
But, when I try inserting into a money column like this:
Code:
sql = "INSERT INTO myTable (myMoney) VALUES ('" & replace(somemoney, "'","''") & "')"
I get this error:
Disallowed implicit conversion from data type varchar to data type money, table 'myTable', column 'myMoney'. Use the CONVERT function to run this query.
But this works:
Code:
sql = "INSERT INTO myTable (myMoney) VALUES (" & replace(somemoney, "'","''") & ")"
Is the documentation wrong or is my understanding wrong? Or, is the conversion implicit only in certain circumstances?