doing math in a select...
Posted on 2003-11-20
my situation is simple.
i have a database table in sql server 2000. this table has some image data (Id, fileName, Width, Height)
i would like to create a select statment that would return this data to me with 2 additional feilds. theis 2 feilds require a math function perfomed on the width and height.
i am trying to make thumbs that would be 100 width. for this i use the formula...
100 / width --> to get the scale
then i do: scaleValue * width to get the width to be 100.
i then use this scaleValue * height to maniupulate the height soto keep the height : width ration tha same and have no distortion in the image [proportions.
sql is giving me problems with this tSQL.
best i can do is...
select *, ( (100 / width) * width ) as smWidth
but the value it gives me is 0 for all images returned. looks liek the tSQL chokes oin the math and is not liking the datatype???
any ideas, or answers???