INSERT INTO DetailAccount (goodsname,indate,invoiceid,summary,addprice,type )SELECT goodsname, indate, id, summary,total,typename=case type2 when 0 then ' + ''' + 专用设备 + ''' + ' when 1 then ' + ''' + 教学仪器 + ''' + ' when 2 then '+ ''' + 一般设备 + '''+ 'end  FROM addstore where date>=#' + StartDate + '# and date<=#' + Enddate + '#
  主要是case这有问题,是access的问题吗?

解决方案 »

  1.   

    语法错误操作符丢失在typename=case type2 when 0 then ' + ''' + 专用设备 + ''' + ' when 1 then ' + ''' + 教学仪器 + ''' + ' when 2 then '+ ''' + 一般设备 + '''+ 'end中
      

  2.   

    Access对于SQL语言的支持不是很多的
    尽量写的简单一些吧
      

  3.   

    Access对CASE 语句不支持!!!用其他方法吧
      

  4.   

    case type2 when 0 then ' + ''' + 专用设备 + ''' + ' when 1 then ' + ''' + 教学仪器 + ''' + ' when 2 then '+ ''' + 一般设备 + '''+ 'end  FROM addstore where date>=#' + StartDate + '# and date<=#' + Enddate + '#ACCESS不支持CASE语句,原因是ACCESS只支持SQL_92标准的语句了
    如果想要实现这个SQL语句的话,还是程序中多做一次查询,再分别操作吧。。