[freetds] The behavior of bcp, blk and insert is not corresponding. (Re: [SOLVED] blk_init fails by the even number times execution)
MATSUMOTO, Tadashi
pineroot at yahoo.co.jp
Mon Mar 12 07:59:12 EDT 2007
Hello all,
MATSUMOTO, Tadashi wrote:
> Thank you! The problem is solved.
> It succeeded as follows.
>
> However, another problem occurred. Details E-mail separately.
The another problem is this. (only tested on 0.64)
Freebcp and the blk function cannot insert space into a numeric column.
The "insert" statement on tsql can insert space into a numeric column as 0.
Sybase bcp and the blk function can insert space into a numeric column as 0.
The "insert" statement on Sybase isql cannot insert space into a numeric column.
Why have the behavior of Sybase and FreeTds reversed?
thanks,
tsql
------------------------
drop table dbo.test_me
create table dbo.test_me (
i integer not null primary key,
c char(1) not null,
v varchar(10) null)
insert into dbo.test_me values (3,' ','string')
insert into dbo.test_me values (1,' ','string2')
insert into dbo.test_me values (2,' ',null)
insert into dbo.test_me values (4,' ',null)
select * from dbo.test_me
go
i i1 i2 c1 c2 v1 v2
1 0 1 a a string string2
2 2 0 b b string string2
3 3 3 c string string2
4 4 4 d string string2
5 5 5 e e string2
6 6 6 f f string
7 7 7 g g string string2
8 8 NULL g NULL string NULL
----------------
freebcp
------------------------
% freebcp "test_me" "out" "test_me.txt" -Sxxxx -c -Uuser -Ppass
Starting copy...
8 rows copied.
% tsql .....
truncate table test_me
go
select * from test_me
go
i i1 i2 c1 c2 v1 v2
% vi test_me.txt
% diff test_me.txt.orig test_me.txt
1,2c1,2
< 1 0 1 a a string string2
< 2 2 0 b b string string2
---
> 1 1 a a string string2
> 2 2 b b string string2
% freebcp "test_me" "in" "test_me.txt" -Sxxxx -c -Uuser -Ppass
Starting copy...
Msg 20050, Level 4
Attempt to convert data stopped by syntax error in source field
Msg 20050, Level 4
Attempt to convert data stopped by syntax error in source field
6 rows copied.
% tsql .......
select * from test_me
go
i i1 i2 c1 c2 v1 v2
3 3 3 c string string2
4 4 4 d string string2
5 5 5 e e string2
6 6 6 f f string
7 7 7 g g string string2
8 8 NULL g NULL string NULL
-----------------------------
More information about the FreeTDS
mailing list