开发者

Convert Column from String to Int - Alter Script MSSQL

开发者 https://www.devze.com 2023-01-31 02:51 出处:网络
Can you change a column from a va开发者_JAVA技巧rchar to an int. I have a table with a zipcode column and I want the zips to be ints instead of varchars.ALTER TABLE [TableName]

Can you change a column from a va开发者_JAVA技巧rchar to an int.

I have a table with a zipcode column and I want the zips to be ints instead of varchars.


ALTER TABLE [TableName]
ALTER COLUMN ZipCode INT


Actually, I suggest you do NOT make that change at all. You are in a better position for future growth if you can support the alphanumeric ZIPs outside of the US, and to do that your ZIP code column should remain a varchar.

For instance, just 2 minutes ago, I received an order from:

Hever, Belgium
VLA3191
0

精彩评论

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