MS Access SQL,更改数据类型 [英] MS Access SQL, changing data type

查看:114
本文介绍了MS Access SQL,更改数据类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Access的设计模式下尝试将数据类型从文本更改为数字时,我始终收到磁盘空间或内存不足"错误,因此我找到了一种解决方法基本上是创建一个新列,将数据类型设置为此处的数字,将旧列的内容复制到其中,删除旧列,然后将新列重命名为旧列的名称.

I keep getting a "not enough disk space or memory" error when trying to change the data type from text to a number in design mode in Access (working with a close to 2 gb database), so I found a workaround by basically creating a new column, setting the data type to number there, copying the old coumns contents in, deleting the old column and renaming the new column to the old column's name.

我听说ALTER TABLE也可以用于更改数据类型.

I heard that ALTER TABLE can be used to change the data type as well.

有人可以给我一个例子,说明如何使用ALTER TABLE将整个列的数据类型从文本更改为Number,

Would someone be able to give me an example of how to use ALTER TABLE to change a whole columns data type to Number from text,

还是有人有更好的方法来更改数据类型?

or does anybody have a better way to change the data type?

推荐答案

本文可以为您提供ALTER TABLE的帮助:

This article can help you with ALTER TABLE: http://msdn.microsoft.com/en-us/library/bb177883(v=office.12).aspx

所以,在您的情况下,语句将是:

So, in your case the statement would be:

ALTER TABLE TableName ALTER COLUMN ColumnName INTEGER

顺便说一句,列==字段(在Access中).除非我错过了什么.

By the way, Column == Field (in Access). Unless I'm missing something.

这篇关于MS Access SQL,更改数据类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆