我无法将以下两个文件中的任何一个上传到高级查询工具中。这是我的数据的快照:
2,"TEST2",2012-01-01,"TEST","TEST",21111
3,"TEST3",2013-01-01,"TEST","TEST",13111
4,"TEST4",2014-01-01,"TEST","TEST",11411
5,"TEST5",2015-01-01,"TEST","TEST",11151
...
我想在SQL中导入此文件。
这是我到目前为止使用的代码:
CREATE TABLE #tb_test
(
id integer,
name varchar(10),
dob date,
city char(20),
state char(20),
zip integer
);
insert into #tb_test
values
(1,'TEST','2015-01-01','TEST','TEST',11111);
BULK INSERT #tb_test
FROM 'H:\tb_test_data.txt'
WITH (FIELDTERMINATOR = ',');
或者,我可以尝试导入稍微修改过的文件,如下所示:
2,TEST2,2012-01-01,TEST,TEST,21111
3,TEST3,2013-01-01,TEST,TEST,13111
4,TEST4,2014-01-01,TEST,TEST,11411
5,TEST5,2015-01-01,TEST,TEST,11151
...
但是,我不愿意,因为第一个文件被分配给我,而第二个文件似乎更容易(即使我还没有那个工作,也是!)。这是我得到的错误消息:
Error during Prepare 37000(-131)[Sybase][ODBC Driver][Sybase IQ]Syntax error near 'BULK' on line 1 (0.05 secs)