openrowset

时间:2017-03-02 19:58:29

标签: multipart

您可以考虑以下代码;

use jefftest;
insert into rep_track with (tablockx) (end_date, end_time)
(select end_date, end_time
from openrowset(bulk 'c:\scripts\sql-stuff\j.log', formatfile='c:\scripts\sql-stuff\endtime.fmt') as dummy
where [rep.track].[run] = 2175 and [rep_track].[rep] = 1)

我得到的错误是

 multi-part identifier "rep_track.run" could not be bound
 multi-part identifier "rep_track.rep" could not be bound

如果我在假人之后放了一个“)”并注释掉“where”导致它起作用(但我需要“where”原因),似乎是“where”原因的问题。任何建议??

1 个答案:

答案 0 :(得分:0)

似乎我使用的是错误的sql命令,我应该使用UPDATE命令。这是工作命令字符串的样子; 用jefftest; 更新rep_track set end_date = i.end_date,end_time = i.end_time from(select end_date,end_time from openrowset(bulk' c:\ scripts \ sql-stuff \ j.log',formatfile =' c:\ scripts \ sql-stuff \ end_time.fmt&#39 ;)作为假人)我 其中rep_track.run = 2175和rep_track.rep = 1