I'm importing data from a text file into SQL as a varchar, and I'm leaving it a varchar in its final destination table. It is essentially a price, i.e., $25.65. I'm using this price field (varchar) to perform a calculation...
Everything seems to work OK, but I'm not sure about using this varchar field to perform this calculation. Is this doable, or should it absolutely be converted to say, decimal?I'm importing data from a text file into SQL as a varchar, and I'm leaving it a varchar in its final destination table. It is essentially a price, i.e., $25.65. I'm using this price field (varchar) to perform a calculation...
Everything seems to work OK, but I'm not sure about using this varchar field to perform this calculation. Is this doable, or should it absolutely be converted to say, decimal?
Why use VARCHAR? Sounds like you want to use currency. You can use CAST at runtime. However, if there are formatting problems, I would think you would want to deal with such errors at import time rather than afterwards during calculations.
Showing posts with label leaving. Show all posts
Showing posts with label leaving. Show all posts
Sunday, February 19, 2012
calculation on a varchar field
Subscribe to:
Posts (Atom)