November 4, 2009 at 11:18 pm
Can any one explain me what this means 🙂
Sum(ISNULL(GSTExclusiveAmt,0))
Regards,
Prathyusha
November 4, 2009 at 11:21 pm
prathyushaa (11/4/2009)
Can any one explain me what this means 🙂Sum(ISNULL(GSTExclusiveAmt,0))
Regards,
Prathyusha
Take the field GSTExclusiveAmt and if it is NULL replace NULL with 0, then sum it with all the other rows..
Really, you could have looked up each of the functions and found this out pretty easily yourself..
CEWII
November 4, 2009 at 11:26 pm
http://msdn.microsoft.com/en-us/library/ms187810.aspx
http://msdn.microsoft.com/en-us/library/ms184325.aspx
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
November 4, 2009 at 11:28 pm
Thanks CEWII but the thing is that i'm a beginner in SQL .
I work as a Systems Tester and dont have much knowledge about Basic Funda's about SQL.
November 5, 2009 at 12:04 am
prathyushaa (11/4/2009)
Thanks CEWII but the thing is that i'm a beginner in SQL .I work as a Systems Tester and dont have much knowledge about Basic Funda's about SQL.
Still a search for ISNULL and SUM would have yielded this in books online was my point..
CEWII
November 5, 2009 at 1:07 am
Thanks for your help and letting me know the sources for SQL
November 5, 2009 at 10:12 pm
Ummm... looking up the two functions in Books Online is certainly the way to go folks, but stop and think about WHY someone wrote the code like that. SUM won't include NULLS so logically, there's no reason for the ISNULL... there is, however, a technical reason for it that won't be obvious by reading Books Online. Any of you know what it might be? I'll give you a hint... the code was written this way to prevent an unwanted return that the GUI could interpret as an error return. What is that unwanted return and how does the code prevent it?
{insert Jeopordy theme song here} 😛
--Jeff Moden
Change is inevitable... Change for the better is not.
November 6, 2009 at 12:19 am
[font="Courier New"]Warning: Null value is eliminated by an aggregate or other SET operation.[/font]
(suppressed by SET ANSI_WARNINGS OFF)
November 6, 2009 at 10:19 pm
Paul White (11/6/2009)
[font="Courier New"]Warning: Null value is eliminated by an aggregate or other SET operation.[/font](suppressed by SET ANSI_WARNINGS OFF)
Correct on both counts... except for distributed transactions (IIRC).
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 9 posts - 1 through 8 (of 8 total)
You must be logged in to reply to this topic. Login to reply