How can I tell SQL Server not to raise an error if I insert or update a string longer than the size of the field - I would like silent truncation in this instance.
+1
A:
set ANSI WARNINGS to OFF
example
create table bla(id varchar(2))
go
insert bla values ('123') --fails
set ANSI_WARNINGS OFF
insert bla values ('123') --succeeds
SQLMenace
2009-02-09 15:26:48
+1
A:
Try casting the variable to the exact type and length before inserting it. That might do the trick. Casting (and converting) are much more flexible. :)
Craig
2009-02-09 15:26:50