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 |
|
John T.
Posting Yak Master
112 Posts |
Posted - 2003-08-18 : 17:47:44
|
| Hello to all. Dummy is stuck again. I have a table that I made an oversight(LOL) and have two fields that are smallint that I should have made decimal. I figured all I have to do is delete the table(no data there yet) and recreate it making those fields decimal instead of integer. I did that but for some reason it still treats those fields as integers. Rounds the numbers that have fractions to wholes. I tried breaking the connection and reconnecting. Still the same. I am pretty sure if I rename the table something different, I would be okay. But then I have to go through the code and change all the tables accordingly. Besides, I would like to know why this is happening. Any help appreciated as always.John |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2003-08-18 : 17:51:25
|
| Please post the DDL that you used to create the table. You are probably not specifying the number of decimal places for those columns.Tara |
 |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2003-08-18 : 18:30:11
|
| How do you define the field? decimal(9,2) for instance (2 dec places).How do you populate? 5/2 will give an integer as both operands are integer whereas5.0/2 or convert(decimal(9,2),5)/2 will give a decimal result.==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
mohdowais
Sheikh of Yak Knowledge
1456 Posts |
Posted - 2003-08-19 : 02:48:18
|
Are you using Enterprise Manager to view the data? It might round off the numbers to make it look like they are integers and not decimals . Use Query Analyzer instead.Owais |
 |
|
|
mr_mist
Grunnio
1870 Posts |
Posted - 2003-08-19 : 06:43:37
|
| If you post an example of your INSERT / UPDATE statement and the corresponding SELECT and result set, it will make it easier for people to tell you what is going wrong. Also you could script the create table statement for the table and post that.-------Moo. :) |
 |
|
|
|
|
|