有一个ACCESS的数据库,想把里面其中一张表的表结构生成create table……的语句,在sql server里面好像可以,不知道ACCESS可不可以实现,难道要我create table 一个字段一个字段的手工加吗

解决方案 »

  1.   

    用查询 然后写上sql语句,执行一下就可以
      

  2.   

    var
     sqlstr1:string;
     sqlstr2:string;
     s:string;
     SysTime:TsystemTime;
    begin
    try
    GetSystemTime(SysTime);
    s:='bf'+IntToStr(SysTime.wYear)+combobox1.text;
    if combobox1.Text='' then
    messagebox(getactivewindow(),'请您选择季度!','错误' ,MB_OK + MB_ICONINFORMATION)
    else
    begin
       case Combobox1.ItemIndex of
        0: sqlStr2:='select * into '+s+' from cost where 通话日期 not between #12-21# and #3-20#';
        1: sqlStr2:='select * into '+s+' from cost where 通话日期 between #3-21#  and  #6-20#';
        2: sqlStr2:='select * into '+s+' from cost where 通话日期 between #6-21#  and  #9-20#';
        3: sqlStr2:='select * into '+s+' from cost where 通话日期 between #9-21#  and  #12-20#';
      end;
       case Combobox1.ItemIndex of
      0: sqlStr1:='delete * from cost where 通话日期 not between #12-21# and #3-20# ';
      1: sqlStr1:='delete * from cost where 通话日期 between #3-21#  and  #6-20# ';
      2: sqlStr1:='delete * from cost where 通话日期 between #6-21#  and  #9-20# ';
      3: sqlStr1:='delete * from cost where 通话日期 between #9-21#  and  #12-20# ';
       end;
    application.ProcessMessages;
    sqlStr:=sqlstr2;
    MyQuery;application.ProcessMessages;
    sqlStr:=sqlstr1;
    MyQuery;
    messagebox(getactivewindow(),'数据备份成功!','恭喜' ,MB_OK + MB_ICONINFORMATION)
    end;
    except
    messagebox(getactivewindow(),'数据备份失败,该数据已备份!','错误' ,MB_OK + MB_ICONINFORMATION)
    end;
    end;
      

  3.   

    唉!!!看来access中不能实现了,不过已经搞定,把这表先导入到sql server中就可以了!!!