• 全部
  • 基础类
  • 应用实例
  • 新技术前沿

bcp格式文件未知版本

isalie 2008-03-18 11:22:58
有一个文本格式如下 数据之间以空格分开

2008010908 54517 -4.2 -1.2 0.7 -3.7 -6.7 -8.1 -9.2 -10.2 -10.8 -3.7 -1.1 -3.5 -6.7 -6.7 -5.9 -5.6 -6.2
2008010908 A3501 -4.3 -1.3 0.6 -3.7 -6.7 -8.2 -9.3 -10.3 -10.8 -3.7 -1.1 -3.6 -6.8 -7.3 -6.2 -5.9 -6.7
2008010908 A3502 -4.3 -1.3 0.6 -3.8 -6.7 -8.2 -9.3 -10.3 -10.9 -3.7 -1.1 -3.6 -6.9 -7.3 -6.2 -5.9 -6.7
2008010908 A3503 -4.4 -1.4 0.6 -3.8 -6.8 -8.2 -9.3 -10.3 -10.9 -3.7 -1.1 -3.7 -6.9 -7.2 -6.2 -5.8 -6.7
2008010908 A3504 -4.4 -1.4 0.6 -3.8 -6.8 -8.2 -9.4 -10.4 -10.9 -3.8 -1.1 -3.7 -6.9 -7.9 -6.5 -6.3 -7.3
2008010908 A3505 -4.3 -1.3 0.6 -3.7 -6.7 -8.2 -9.3 -10.3 -10.8 -3.7 -1.1 -3.6 -6.8 -7.3 -6.2 -5.9 -6.7
2008010908 A3506 -4.3 -1.3 0.6 -3.8 -6.7 -8.2 -9.3 -10.3 -10.9 -3.7 -1.1 -3.6 -6.9 -7.3 -6.2 -5.9 -6.7
2008010908 A3507 -4.5 -1.5 0.5 -3.8 -6.8 -8.3 -9.4 -10.4 -11 -3.8 -1.2 -3.8 -7 -7.7 -6.5 -6.3 -7.3
我写了段格式文件如下
8.0
19
1 sqlchar 0 10 " " 1 datatime sql_latin1_general_cp437_as
2 sqlchar 0 5 " " 2 station_id sql_latin1_general_cp437_as
3 sqlchar 0 8 " " 3 A08 sql_latin1_general_cp437_as
4 sqlchar 0 8 " " 4 A11 sql_latin1_general_cp437_as
5 sqlchar 0 8 " " 5 A14 sql_latin1_general_cp437_as
6 sqlchar 0 8 " " 6 A17 sql_latin1_general_cp437_as
7 sqlchar 0 8 " " 7 A20 sql_latin1_general_cp437_as
8 sqlchar 0 8 " " 8 A23 sql_latin1_general_cp437_as
9 sqlchar 0 8 " " 9 B02 sql_latin1_general_cp437_as
10 sqlchar 0 8 " " 10 B05 sql_latin1_general_cp437_as
11 sqlchar 0 8 " " 11 B08 sql_latin1_general_cp437_as
12 sqlchar 0 8 " " 12 B11 sql_latin1_general_cp437_as
13 sqlchar 0 8 " " 13 B14 sql_latin1_general_cp437_as
14 sqlchar 0 8 " " 14 B17 sql_latin1_general_cp437_as
15 sqlchar 0 8 " " 15 B20 sql_latin1_general_cp437_as
16 sqlchar 0 8 " " 16 B23 sql_latin1_general_cp437_as
17 sqlchar 0 8 " " 17 C02 sql_latin1_general_cp437_as
18 sqlchar 0 8 " " 18 C05 sql_latin1_general_cp437_as
19 sqlchar 0 8 " " 19 C08 sql_latin1_general_cp437_as

<a href="http://picasaweb.google.com/stin.wang/EcOuqF/photo#5178916515479210034"><img src="http://lh3.google.com/stin.wang/R981IbqKyDI/AAAAAAAAAUo/t13h0sxGAN0/s144/2.JPG" /></a>
...全文
61 点赞 收藏 2
写回复
2 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
xingchenbbs 2008-03-19
星辰技术社区:www.netcsharp.cn,我们将帮您以最快的速度找到最佳的解决方案
回复
isalie 2008-03-18
是不是我的问题没有表达清楚

数据文件是不同站点的空气温度数据,各列分别为时间、站号、不同时次的预报温度,数据之间以空格分开,每行最后回车加换行
2008010908 54517 -4.2 -1.2 0.7 -3.7 -6.7 -8.1 -9.2 -10.2 -10.8 -3.7 -1.1 -3.5 -6.7 -6.7 -5.9 -5.6 -6.2
2008010908 A3501 -4.3 -1.3 0.6 -3.7 -6.7 -8.2 -9.3 -10.3 -10.8 -3.7 -1.1 -3.6 -6.8 -7.3 -6.2 -5.9 -6.7
2008010908 A3502 -4.3 -1.3 0.6 -3.8 -6.7 -8.2 -9.3 -10.3 -10.9 -3.7 -1.1 -3.6 -6.9 -7.3 -6.2 -5.9 -6.7
2008010908 A3503 -4.4 -1.4 0.6 -3.8 -6.8 -8.2 -9.3 -10.3 -10.9 -3.7 -1.1 -3.7 -6.9 -7.2 -6.2 -5.8 -6.7
2008010908 A3504 -4.4 -1.4 0.6 -3.8 -6.8 -8.2 -9.4 -10.4 -10.9 -3.8 -1.1 -3.7 -6.9 -7.9 -6.5 -6.3 -7.3
2008010908 A3505 -4.3 -1.3 0.6 -3.7 -6.7 -8.2 -9.3 -10.3 -10.8 -3.7 -1.1 -3.6 -6.8 -7.3 -6.2 -5.9 -6.7
2008010908 A3506 -4.3 -1.3 0.6 -3.8 -6.7 -8.2 -9.3 -10.3 -10.9 -3.7 -1.1 -3.6 -6.9 -7.3 -6.2 -5.9 -6.7
2008010908 A3507 -4.5 -1.5 0.5 -3.8 -6.8 -8.3 -9.4 -10.4 -11 -3.8 -1.2 -3.8 -7 -7.7 -6.5 -6.3 -7.3


我想把这样的数据文件导入到数据库当中,数据库的格式如下
id int 4
datatime char 10
station-id char 5
a08 float 8
a11 float 8
a14 float 8
... ...
c08 float 8

我仿照sql的帮助当中关于格式文件写了下面的文件
8.0
19
1 sqlchar 0 10 " " 2 datatime sql_latin1_general_cp437_as
2 sqlchar 0 5 " " 3 station_id sql_latin1_general_cp437_as
3 sqlchar 0 8 " " 4 A08 sql_latin1_general_cp437_as
4 sqlchar 0 8 " " 5 A11 sql_latin1_general_cp437_as
5 sqlchar 0 8 " " 6 A14 sql_latin1_general_cp437_as
6 sqlchar 0 8 " " 7 A17 sql_latin1_general_cp437_as
7 sqlchar 0 8 " " 8 A20 sql_latin1_general_cp437_as
8 sqlchar 0 8 " " 9 A23 sql_latin1_general_cp437_as
9 sqlchar 0 8 " " 10 B02 sql_latin1_general_cp437_as
10 sqlchar 0 8 " " 11 B05 sql_latin1_general_cp437_as
11 sqlchar 0 8 " " 12 B08 sql_latin1_general_cp437_as
12 sqlchar 0 8 " " 13 B11 sql_latin1_general_cp437_as
13 sqlchar 0 8 " " 14 B14 sql_latin1_general_cp437_as
14 sqlchar 0 8 " " 15 B17 sql_latin1_general_cp437_as
15 sqlchar 0 8 " " 16 B20 sql_latin1_general_cp437_as
16 sqlchar 0 8 " " 17 B23 sql_latin1_general_cp437_as
17 sqlchar 0 8 " " 18 C02 sql_latin1_general_cp437_as
18 sqlchar 0 8 " " 19 C05 sql_latin1_general_cp437_as
19 sqlchar 0 8 " " 20 C08 sql_latin1_general_cp437_as
格式文件当中用tab键隔开

bcp greenhouse..temp in tempdata.txt -ftemp.fmt -Sservername -Usa -Ppassword
系统报错,试图读取bcp格式文件的未知版本。不知道是不是这个bcp文件必须由系统生成不能自己手写的啊。

回复
相关推荐
发帖
MS-SQL Server
创建于2007-09-28

3.3w+

社区成员

MS-SQL Server相关内容讨论专区
申请成为版主
帖子事件
创建了帖子
2008-03-18 11:22
社区公告
暂无公告