开发者

Changing data types in SQL Server 2005

开发者 https://www.devze.com 2023-01-19 21:32 出处:网络
I have several tables in SQL Server 2005 that have columns开发者_如何学JAVA with datatype money. I would like to change them into datatype numeric(20, 2). I am a lazy guy so would like to update each

I have several tables in SQL Server 2005 that have columns开发者_如何学JAVA with datatype money. I would like to change them into datatype numeric(20, 2). I am a lazy guy so would like to update each and every money data types to numeric data types with as little hassle as possible.

Can anyone help please.

Thank you so very much.


alter table yourtable alter column yourcolumn numeric(20, 2) null


Remeber to use the smallest datatype that is possible. A numeric(20,2) will take 13 bytes for every column and every row and the performance will suffer. If you can use numeric(19,2) you will only use 9 bytes instead. With monye you will use 8 bytes and you can handle values up to 922 337 203 685 477.5807

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号