什么是MSAccess中要重命名的DDL列? [英] What is the DDL to rename column in MSAccess?

查看:44
本文介绍了什么是MSAccess中要重命名的DDL列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

重命名MS Access中的列的DDL是什么?类似于以下内容:

What is the DDL to rename a column in MS Access? Something along the lines of:

alter table myTable rename col1 to col2

不适用于MSAccess 2000格式的数据库.我正在将OLEDB或ADO.NET与MSAccess 2000格式的db一起使用,但希望对语法或如何以其他方式使用ADO.NET实现这一点提出任何建议.

which does not work for MSAccess 2000 format databases. I'm using OLEDB or ADO.NET with a MSAccess 2000 format db but would be grateful of any hint at the syntax or a suggestion as to how to achieve this using ADO.NET in some other way.

推荐答案

我在家里,目前无法对此进行测试,但我认为这应该可行.此网站具有有关此信息.

I am at home and can't test this at the moment, but I think this should work. This site has information about it.

ALTER TABLE thetable ALTER COLUMN fieldname fieldtype

编辑我做了一点测试,奇怪的是,您无法重命名我可以找到的列. ALTER COLUMN语法仅允许更改类型.使用SQL,似乎有必要删除该列,然后再将其添加回.我想数据可以保存在临时表中.

Edit I tested this a bit and oddly enough, you can't rename a column that I can find. The ALTER COLUMN syntax only allows for changing type. Using SQL, it seems to be necessary to drop the column and then add it back in. I suppose the data could be saved in a temporary table.

alter table test drop column i;
alter table test add column j integer;

这篇关于什么是MSAccess中要重命名的DDL列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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