大家好!请问在用下面的SQL导入EXCEL数据至表T时,怎样使这一次导入EXCEL生成一从1开始递增的序号?
 String  sql="insert into T(a,b) " +
            "select "+Product_Code+","+Product_Name+" from " +
"OpenDataSource('Microsoft.Jet.OLEDB.4.0','Data Source=\""+path+"\";Extended " +
"Properties=Excel 5.0')..."+sheetnm+"$ where "+se+" is not null";

解决方案 »

  1.   

    String  sql="insert into T(a,b) " + 
              "select "+Product_Code+","+Product_Name+" from " + 
    "OpenDataSource('Microsoft.Jet.OLEDB.4.0','Data Source=\""+path+"\";Extended " + 
    "Properties=Excel 5.0')..."+sheetnm+"$ where "+se+" is not null";表中加个IDENTITY列?
      

  2.   


    alter table tb add id int identity(1,1)
      

  3.   

    我是要按当次导入的EXCEL记录按从1起排列