Create table TEST
(
Client_Code Varchar(255),
Segment Varchar(255),
Symbol Varchar(255),
Instrument Varchar(255),
Expiry Datetime,
Strike_Price Numeric(18,8),
Opt_Type Varchar(255),
Buy_Qty Varchar(255),
Buy_Value Varchar(255),
Sell_Qty Varchar(255),
Sell_Value Varchar(255),
Product Varchar(255)
)
bulk insert TEST
from 'D:\Filewithdata.txt'
with (firstrow = 1,FIELDTERMINATOR = ',',rowterminator = '\n')
go
我正在使用上面的代码批量上传附加文件
当文件包含Header plus data
row 1
并且我从header
中提取row 1 column:= Client_Code
时
但有一天文件可能是空白的,header
row 1
文件空白时如何运行?
答案 0 :(得分:-1)
Create table TEST
(
Client_Code Varchar(255),
Segment Varchar(255),
Symbol Varchar(255),
Instrument Varchar(255),
Expiry Datetime,
Strike_Price Numeric(18,8),
Opt_Type Varchar(255),
Buy_Qty Varchar(255),
Buy_Value Varchar(255),
Sell_Qty Varchar(255),
Sell_Value Varchar(255),
Product Varchar(255),
)
bulk insert TEST
from 'D:\Filewithdata.txt'
with (firstrow = 1,FIELDTERMINATOR = ',',rowterminator = '\n')
go