Thursday, March 22, 2012

error 8152

I read the Error Handling article by Erland Sommarskog, he said when
ANSI_WARNINGS is OFF, assigning a char column a value that exceeds the max
length of the column will not result any error. But I still get error 8152:
String or binary data would be truncated, within a trigger, even I set
ANSI_WARNINGS to OFF. Anybody knows why? Is it because of the Trigger Contex
t?hi
Just see this:
ANSI_WARNINGS
When set to ON, errors or warnings are issued when conditions such as
"divide by zero" occur or null values appear in aggregate functions. When se
t
to OFF, no warnings are raised when null values appear in aggregate
functions, and null values are returned when conditions such as "divide by
zero" occur. By default, ANSI_WARNINGS is OFF.
SET ANSI_WARNINGS must be set to ON when you create or manipulate indexes on
computed columns or indexed views.
Connection-level settings (set using the SET statement) override the default
database setting for ANSI_WARNINGS. By default, ODBC and OLE DB clients issu
e
a connection-level SET statement setting ANSI_WARNINGS to ON for the session
when connecting to SQL Server. For more information, see SET ANSI_WARNINGS.
The status of this option can be determined by examining the
IsAnsiWarningsEnabled property of the DATABASEPROPERTYEX function
best Regards,
Chandra
http://chanduas.blogspot.com/
http://groups.msn.com/SQLResource/
---
"nonno" wrote:
> I read the Error Handling article by Erland Sommarskog, he said when
> ANSI_WARNINGS is OFF, assigning a char column a value that exceeds the max
> length of the column will not result any error. But I still get error 8152
:
> String or binary data would be truncated, within a trigger, even I set
> ANSI_WARNINGS to OFF. Anybody knows why? Is it because of the Trigger Context?[/co
lor]|||Can you post a reproduction script?
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"nonno" <nonno@.discussions.microsoft.com> wrote in message
news:A6D01321-73CE-4EE8-BACC-B8C2B9A08F06@.microsoft.com...
>I read the Error Handling article by Erland Sommarskog, he said when
> ANSI_WARNINGS is OFF, assigning a char column a value that exceeds the max
> length of the column will not result any error. But I still get error 8152
:
> String or binary data would be truncated, within a trigger, even I set
> ANSI_WARNINGS to OFF. Anybody knows why? Is it because of the Trigger Context?[/co
lor]|||thx 4 ur reply, Chandra
I know that Query Analyzer is connected thro' ODBC, but I get 0 from
IsAnsiWarningsEnabled property of the DATABASEPROPERTYEX function, and I'm
sure that the connection property 'Set ansi_warnings' is ON, any idea?
"Chandra" wrote:
> hi
> Just see this:
> ANSI_WARNINGS
> When set to ON, errors or warnings are issued when conditions such as
> "divide by zero" occur or null values appear in aggregate functions. When
set
> to OFF, no warnings are raised when null values appear in aggregate
> functions, and null values are returned when conditions such as "divide by
> zero" occur. By default, ANSI_WARNINGS is OFF.
> SET ANSI_WARNINGS must be set to ON when you create or manipulate indexes
on
> computed columns or indexed views.
> Connection-level settings (set using the SET statement) override the defau
lt
> database setting for ANSI_WARNINGS. By default, ODBC and OLE DB clients is
sue
> a connection-level SET statement setting ANSI_WARNINGS to ON for the sessi
on
> when connecting to SQL Server. For more information, see SET ANSI_WARNINGS
.
> The status of this option can be determined by examining the
> IsAnsiWarningsEnabled property of the DATABASEPROPERTYEX function
>
> --
> best Regards,
> Chandra
> http://chanduas.blogspot.com/
> http://groups.msn.com/SQLResource/
> ---
>
> "nonno" wrote:
>

No comments:

Post a Comment