Groups | Blog | Home
all groups > sql server (alternate) > august 2003 >

sql server (alternate) : String or binary data would be truncated


TZone
8/29/2003 5:14:50 PM
Is there anything I can put in a stored procedure so instead of proc falling
over because of "String or binary data would be truncated" the offending
records are just truncated?

Thanks for any help!

Erland Sommarskog
8/29/2003 9:28:54 PM
TZone (TZone@optus.com.au) writes:
[quoted text, click to view]

Yes, you can include SET ANSI_WARNINGS OFF.

Two caveats:

o ANSI_WARNINGS must be on for queries that involves linked servers,
indexed views and indexes on computed columns. Thus setting
ANSI_WARNINGS OFF can cause the query to fail to run much slower.
o Putting SET ANSI_WARNINGS OFF in a procedure will trigger a
recompilation of the procedure, so it might be better to set it
before calling the procedure.


--
Erland Sommarskog, SQL Server MVP, sommar@algonet.se

Books Online for SQL Server SP3 at
AddThis Social Bookmark Button