帮帮忙:Access 中的奇怪问题!Alter Table

 所属目录:Java   |   类型:技术问答   |   时间:2007-05-21
 问题:

access   中如果用sql语句建立表的时候,声明自动编号类型的字段用"counter",如create   table1   (fieldname   counter   )   执行没有问题。  
   
  而用alter   table1   alter   column   fieldname   counter   便不行。  
  而     alter   table1   alter   column   fieldname   number   却是可以的。  
   
        有谁知道这是怎么回事,我应该用什么sql语句把一个字段从“整数”类型强制转换成“自动编号”类型呢?(开发语言中需要动态变换,所以,不用access中的表设计器)  
   
        致敬!期盼回音。

· 网友精彩回答:

发表者:tjianliang

create   table   table1   (field1   counter)  
   
  alter   table   table1   alter   field1   number  
  字段field1改成了整型    
  alter   table   table1   alter   field1   counter    
  字段field1又改成了自动编号    
   
  执行alter   table时要确保表没有被打开,而且由整型修改成自动编号时如果表里有数据会失败,没有数据是可以的。  
  不太清楚你为什么要“动态变换”,可以设为整型,然后添加记录时程序自动计算,不是很好控制吗  
 

.
处理 SSI 文件时出错
© 2006-2008 All Rights Reserved