| Author |
Topic |
|
josh2009
Yak Posting Veteran
81 Posts |
Posted - 2009-09-01 : 12:35:52
|
| I have an integer time (minutes) column that needs to be changed to store decimal values. I tried changing to decimal with 2 decimal places to store the seconds but when I save the changed data, it automatically rounds off to nearest whole number. I've also tried money data type and it still rounds off. Any help would be greatly appreciated. thanks |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2009-09-01 : 12:42:50
|
Can you show your statement? No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
josh2009
Yak Posting Veteran
81 Posts |
Posted - 2009-09-01 : 12:49:42
|
| I'm just changing the data type via SQL Server Management Studio and trying out different data types in attempts to store decimal values (second) in the time field. Thanks |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2009-09-01 : 12:54:13
|
Yes and can you show the way how you did try to store the decimal values? No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
josh2009
Yak Posting Veteran
81 Posts |
Posted - 2009-09-01 : 13:02:46
|
| We have an application built via Visual Studio 2005 and the time field is a simple text box where user can enter the time. |
 |
|
|
josh2009
Yak Posting Veteran
81 Posts |
Posted - 2009-09-01 : 13:04:53
|
| I entered 2.55 or 1.33 and everytime I save the screen changes, values entered are rounded off. I have tried decimal, numeric, float , money, smallmoney and a few others and each time, values were rounded off. I;ve looked on the front end, and I cant find any object property that would pertain to any rounding off that might cause it to do so. |
 |
|
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2009-09-01 : 13:18:34
|
| Does your application call a stored procedure with parameters? Or does it build an in-line INSERT statement which is then executed on the server? I suspect you have a parameter somewhere in that process that is set to Integer so by the time it gets to Sql Server it has been rounded. Use Sql Profiler to capture the insert statement. If the value coming is already rounded then it's an application problem.Be One with the OptimizerTG |
 |
|
|
josh2009
Yak Posting Veteran
81 Posts |
Posted - 2009-09-01 : 13:32:32
|
| Good point. I have not used sql profiler. Can you tell me how I can use it to capture the insert statement? thanks |
 |
|
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2009-09-01 : 13:54:37
|
| start | programs | Sql Server | performance Tools | sql server profilerORfrom management studio: Tools | Sql Server Profilerfrom profiler:File | New TraceOnce your trace is running add a new value with your application. You should be able to find the statement in your trace output.Be One with the OptimizerTG |
 |
|
|
|