Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 SET ANSI_WARNINGS OFF;

Author  Topic 

ferrethouse
Constraint Violating Yak Guru

352 Posts

Posted - 2009-09-17 : 15:08:40
I put this...

SET ANSI_WARNINGS OFF;

in my trigger but on my asp page i still get this...

Microsoft OLE DB Provider for SQL Server error '80004005'

Warning: Null value is eliminated by an aggregate or other SET operation.

Shouldn't it not output that warning?

UPDATE: The warning also shows in SSMS when I do an insert to fire the trigger.

ferrethouse
Constraint Violating Yak Guru

352 Posts

Posted - 2009-09-17 : 16:04:48
Alternatively, this is the line causing the warning. I don't know why it causes a warning. If I can get rid of the warning I don't need to turn them off :)

DECLARE @USERID varchar(10)
DECLARE @COURSEID varchar(10)

SELECT @USERID = STUDENTSID, @COURSEID = COURSEID FROM inserted
Go to Top of Page

Bustaz Kool
Master Smack Fu Yak Hacker

1834 Posts

Posted - 2009-09-17 : 19:57:29
Apropos of nothing...

Your trigger does make the assumption that you are only inserting a single record. This can be dangerous when the assumption proves false.

As to your issue; are you sure that it is thew trigger that is throwing the error message? Can you disable the trigger and try to insert some data?

Some of the SET values are in effect at the time that you run the code but others are in effect from the time that the objects (e.g., table, trigger, stored procedure, etc.) were created. you may want to investigate whether this SET falls into one camp or the other.

=======================================
Men build too many walls and not enough bridges. -Isaac Newton, philosopher and mathematician (1642-1727)
Go to Top of Page
   

- Advertisement -