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 |
rjhe22
Constraint Violating Yak Guru
283 Posts |
Posted - 2014-08-13 : 06:33:37
|
hii have the following codeSELECT Quantity FROM dbo.BNYForwardsTaxLotsForwards WHERE investmentType ='Forward Cash' and Quantity < 0 and i get the follwoing errorMsg 245, Level 16, State 1, Line 1Conversion failed when converting the nvarchar value '-12213949.9' to data type int.dont understand why i get it. any ideas |
|
Ifor
Aged Yak Warrior
700 Posts |
Posted - 2014-08-13 : 07:18:29
|
You will need to cast the string '-12213949.9' to either a decimal or float first, decide how you want to round it and then cast to an int. |
|
|
Ifor
Aged Yak Warrior
700 Posts |
Posted - 2014-08-13 : 07:19:42
|
quote: Originally posted by Ifor You will need to cast the string '-12213949.9' to either a decimal or float first, decide how you want to round it and then cast to an int.An alternative would just be to compare to the float constant 0.0
|
|
|
|
|
|