| Author |
Topic |
|
konark
Yak Posting Veteran
60 Posts |
Posted - 2009-07-16 : 19:53:59
|
| An Table is having a column which is INT data type. Already running application .Now I need to store a value 0.5 in that column which is INT.Please advise what should I do . Should i modify the datatype .if so , to what ??The column is already having million of values already . Wont it affect ?Chandragupta Mourya |
|
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2009-07-16 : 20:05:02
|
| You should change it to whatever it needs to be, probably a numeric. What type of values do you need it to store? You won't lose anything if you convert from int to float or numeric.Jim |
 |
|
|
konark
Yak Posting Veteran
60 Posts |
Posted - 2009-07-17 : 00:55:52
|
| the data type was INT andit used to store millions ofvalues .But now one new requirement needs to store 0.5 which is decimal. So i need to figure out .1) TO What data type i need to change that column ?2) Will there be any implicit data type conversion from INT to that data type , so that wewont have to change the procedures.Chandragupta Mourya |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2009-07-17 : 01:00:25
|
1) you can use decimal data type.2) yes. No issue for converting Integer to decimal3) Did you also consider the output part ? Now your data type is decimal, can you application or stored procedure handle that ? KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
konark
Yak Posting Veteran
60 Posts |
Posted - 2009-07-17 : 12:34:51
|
| yes. No issue for converting Integer to decimalWill it implicitly convert from INT to decimal . previous Procedures are written as INT data type ?Chandragupta Mourya |
 |
|
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2009-07-17 : 12:46:10
|
| If your procedures are written as ints, they will be just fine in the database. You don't have to convert them to numeric before inserting. They will be implicitly converted from int to numeric However, if your procedures are written as ints, where does .5 come from?Jim |
 |
|
|
konark
Yak Posting Veteran
60 Posts |
Posted - 2009-07-17 : 12:49:02
|
| I said all old procedures are written to handle INT , as the column was INT before. Now the new procedure 's requirement is to input values like 0.5 which is numeric . So are you agreeing , it will implicitly convert from INT to Decimal /Numeric . We dont have to unload the data in production m before changing the data type ???Chandragupta Mourya |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-07-17 : 13:56:04
|
quote: Originally posted by konark I said all old procedures are written to handle INT , as the column was INT before. Now the new procedure 's requirement is to input values like 0.5 which is numeric . So are you agreeing , it will implicitly convert from INT to Decimal /Numeric . We dont have to unload the data in production m before changing the data type ???Chandragupta Mourya
if procedure has to input values like 0.5 then its parameter needs to be changed to be of type numeric or decimal |
 |
|
|
Jeff Moden
Aged Yak Warrior
652 Posts |
Posted - 2009-07-19 : 18:30:55
|
As well as what Visakh16 has pointed out, you'll also need to rebuild at least the clustered index to handle some of the page splits that will occur during the datatype change.--Jeff Moden "Your lack of planning DOES constitute an emergency on my part... SO PLAN BETTER! ""RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row" |
 |
|
|
|