产生的错误是:
Msg 207, Level 16, State 1, Line 9
Invalid column name 'Email'.
代码:
-- Bulk insert data from csv file into server temp table
BULK INSERT vwTemporaryIT_USE_ONLY_Import FROM 'C:\Bulk\b_email.csv'
WITH (
FIELDTERMINATOR = ',',
ROWTERMINATOR = '\n'
)
Go
-- Set the flag in db for all records imported from csv
UPDATE [APTIFY].[dbo].[Person]
SET
[IT_Use_Only] = 1
WHERE
[Email] IN
(Select [Email] From vwTemporaryIT_USE_ONLY_Import)
Go
我可以看到vwTemporaryIT_USE_ONLY_Import
表正在填充CSV中的数据,但似乎以下声明由于某种原因失败:
WHERE
[Email] IN
(Select [Email] From vwTemporaryIT_USE_ONLY_Import)
我当然不是这方面的专家,我可能没有正确设置表或查看,因为我最近添加了Email
列。但它们的匹配数据类型为nvchar(100) not null
。我也试过它为null。我甚至不确定IN
是否处理nvchar
这是我的SQL专业知识水平。什么线索我做错了什么?
答案 0 :(得分:0)
其实没有!在Person
表中,它被称为Email1
。我已将代码更改为:
WHERE [Email1]
IN
(Select [Email] From wTemporaryIT_USE_ONLY_Import)
......现在它运作正常。谢谢你的帮助!!