When using AquaData or JDBC (inet tds driver), when doing an insert, I get error "String or binary data would be truncated" when the data is actually OK. There are no triggers, etc. that would confuse the situation.

The scenario is as follows:

Create table:
create table test3 (
name varchar (18) ,
tbname varchar (18)
)

Create and populate table:
create table maxtable (
tablename varchar (18) not null,
[...]
)

Try to insert into test3:
insert into test3 (name, tbname)
select i.name, o.name
from dbo.sysindexes i, sysobjects o, maxtable m
where i.indid > 0 and i.indid < 255
and i.id = o.id and i.indid = 1
and o.name = lower(m.tablename)

And I get the error "String or binary data would be truncated." The values being selected for i.name and o.name have maximum length of 18. There are other rows in sysindexes and sysobjects with longer values, but they are not being selected.

The error does not occur with SQL Server Management Studio, and does not occur using SqlServer 2000.