Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/73.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql EXCEL导入和一些附加列-赢得';不进口_Sql_Sql Server_Excel - Fatal编程技术网

Sql EXCEL导入和一些附加列-赢得';不进口

Sql EXCEL导入和一些附加列-赢得';不进口,sql,sql-server,excel,Sql,Sql Server,Excel,我正在尝试将一些数据导入我的表(SQL SERVER)-这很容易,但我还有一些列附加到末尾,而不是XLS中。我不能只是去把它们添加到XLS上,因为这是一项自动化任务,我需要每周完成一次 因此,我尝试在导入本身中查看select,它实际上将它们放在查询的前面,例如 它将带回联系人,评论,*(其余的行),若我可以交换这个顺序,我相信这会起作用。还有什么我可以做的吗 insert into BusinessSignups select * from openrowset (

我正在尝试将一些数据导入我的表(SQL SERVER)-这很容易,但我还有一些列附加到末尾,而不是XLS中。我不能只是去把它们添加到XLS上,因为这是一项自动化任务,我需要每周完成一次

因此,我尝试在导入本身中查看select,它实际上将它们放在查询的前面,例如

它将带回联系人,评论,*(其余的行),若我可以交换这个顺序,我相信这会起作用。还有什么我可以做的吗

 insert into BusinessSignups 
   select * from openrowset
      (
      'Microsoft.Jet.OLEDB.4.0',
      'Excel 8.0;Database=C:\Oracle\Business-Support-Signups\result1.xls', 
      'SELECT *, 0 as contact,null as comments FROM [result$]'
       )t
        where not exists 
         (select 1
          from BusinessSignups
           where BusinessSignups.week = t.week
           and BusinessSignups.year = t.year
           and BusinessSignups.account_id = t.account_id
          ) 
      go

将添加的列移动到
select*fromOpenRowset
行?哈哈哈,这是最简单的事情-rockstar。案件结案!