July 4, 2013 at 4:53 pm
I've got a column, in 1 table, that's a smallint. Then I've got another table with the same column name (it's meant to be the same thing) but it is a float. I'd really like to change the data type in the first table to a float, too, but am concerned that I might loose data. May I just change the data type from smallint to float, and will SQL Server 2008 R2 keep my data?
Rod
July 4, 2013 at 5:22 pm
yes
July 8, 2013 at 10:31 am
What does the column hold? If the smallint holds all the appropriate values, I'd go the other way, making the float into a smallint. Float is an approximate data type, so there are interesting issues that can crop up with its usage when not properly applied.
July 8, 2013 at 10:32 am
Yes, SQL Server will retain the values when you change the data type.
Mark
July 8, 2013 at 10:59 am
I think David is on to something here. If both columns are meant to be the same and they actually do hold smallint data, then convert the float column to a smallint data type. Your table size will be smaller and you won't suffer from the approximate data type.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply