Author |
Topic |
dzabor
Posting Yak Master
138 Posts |
Posted - 2010-09-21 : 08:47:03
|
I run a script and it works fine, but when I place into a job as a stored procedure it throws the following error:"Warning: Null value is eliminated by an aggregate or other SET operation."UPDATE DNN_IMIS_SECURITY_NAMESET SECURITY_ROLE = security_role + ',11'FROM DNN_IMIS_SECURITY_NAME D JOIN ( SELECT ACTIVITY.ID, Max(ACTIVITY.THRU_DATE) AS MaxDate FROM ACTIVITY WHERE ACTIVITY.ACTIVITY_TYPE = 'SUB' GROUP BY ACTIVITY.ID ) M ON D.ID = M.IDWHERE M.MaxDate <= DATEADD(mm, +3, DATEDIFF(DAY, 0, CURRENT_TIMESTAMP))and M.MaxDate >= GetDate() AND SECURITY_ROLE Not LIKE '%11%'and SECURITY_ROLE LIKE '%,5%' or M.MaxDate <= DATEADD(mm, +3, DATEDIFF(DAY, 0, CURRENT_TIMESTAMP))and M.MaxDate >= GetDate() and SECURITY_ROLE LIKE '5,%' AND SECURITY_ROLE Not LIKE '%11%'or M.MaxDate <= DATEADD(mm, +3, DATEDIFF(DAY, 0, CURRENT_TIMESTAMP))and M.MaxDate >= GetDate() and SECURITY_ROLE = '5' AND SECURITY_ROLE Not LIKE '%11%'How can I set this to run and allow the nulls?Thanks,dz |
|
rohitvishwakarma
Posting Yak Master
232 Posts |
Posted - 2010-09-21 : 08:52:19
|
UPDATE DNN_IMIS_SECURITY_NAMESET SECURITY_ROLE = ISNULL(security_role,some_default_value) + ',11'ex: SET SECURITY_ROLE = ISNULL(security_role,'0') + ',11' |
|
|
rohitvishwakarma
Posting Yak Master
232 Posts |
Posted - 2010-09-21 : 08:54:20
|
and if you don't want to consider Nulls then Add the following to the WHERE ClauseAND SECURITY_ROLE IS NOT NULL |
|
|
X002548
Not Just a Number
15586 Posts |
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2010-09-21 : 10:38:09
|
It's not an error, it's just a warning message. You can suppress it by running SET ANSI_WARNINGS OFF before your query if you absolutely have to. |
|
|
jcelko
Esteemed SQL Purist
547 Posts |
Posted - 2010-09-21 : 16:58:25
|
quote: Originally posted by dzabor I run a script and it works fine, but when I place into a job as a stored procedure it throws the following error:"Warning: Null value is eliminated by an aggregate or other SET operation."
It is a warning, not an exception. You can keep running if that makes sense for your business rules.--CELKO--Books in Celko Series for Morgan-Kaufmann PublishingAnalytics and OLAP in SQLData and Databases: Concepts in Practice Data, Measurements and Standards in SQLSQL for SmartiesSQL Programming Style SQL Puzzles and Answers Thinking in SetsTrees and Hierarchies in SQL |
|
|
dzabor
Posting Yak Master
138 Posts |
Posted - 2010-10-08 : 16:32:20
|
Thanks - that worked.dz |
|
|
mmkrishna1919
Yak Posting Veteran
95 Posts |
Posted - 2013-04-17 : 09:31:02
|
Hi All,I too facing the same issue in my complex proc.How Can i check which line causing this issues?ThanksM.MURALI kRISHNA |
|
|
bandi
Master Smack Fu Yak Hacker
2242 Posts |
Posted - 2013-04-17 : 09:39:04
|
quote: Originally posted by mmkrishna1919 Hi All,I too facing the same issue in my complex proc.How Can i check which line causing this issues?ThanksM.MURALI kRISHNA
Simply set ANSI_WARNINGS OFF--Chandu |
|
|
|