Is a strict mode for inserting strings possible

Database
Enthusiast

Is a strict mode for inserting strings possible

I have created a table with a column that is varchar(5). When I insert a string of 6 characters the string is truncated to 5 characters rather than throwing an exception. Is there a way to force a strict mode so this will result in an error?

Jesse
2 REPLIES
Enthusiast

Re: Is a strict mode for inserting strings possible

Some sql to demonstrate the issue:

create table ft3 (string varchar(5));
insert into ft3 ('hello');
insert into ft3 ('1234567');
select * from ft3;

the last select results in:

12345
hello

I would have liked an error instead of truncating 1234567
Enthusiast

Re: Is a strict mode for inserting strings possible

Hi

You have to change transaction semantics from teradata to ANSI

in bteq, before logon:

.set session transaction ANSI;