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
 General SQL Server Forums
 New to SQL Server Programming
 Wrong number of arguments on ISNULL??

Author  Topic 

chien_fu
Starting Member

16 Posts

Posted - 2007-12-19 : 00:02:11
Can anyone tell me why I would be getting this error on the following query?

Wrong number of arguments used with function in query expression 'ISNULL((SELECT Sum(Game_Schedule.Score) FROM Game_Schedule WHERE Game_Schedule.T1_ID = standings.ID),0) + ISNULL((SELECT Sum(Game_Schedule.Opp_Score) FROM Game_Schedule WHERE Game_Schedule.T2_ID = standings.ID),0)'.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2007-12-19 : 00:16:27
try like this:-

(SELECT ISNULL(Sum(Game_Schedule.Score),0) FROM Game_Schedule WHERE Game_Schedule.T1_ID = standings.ID)
+
(SELECT ISNULL(Sum(Game_Schedule.Opp_Score),0) FROM Game_Schedule WHERE Game_Schedule.T2_ID = standings.ID)
Go to Top of Page

chien_fu
Starting Member

16 Posts

Posted - 2007-12-19 : 00:30:02
Same thing.. seems like I've tried every configuration with the same error..
Go to Top of Page

chien_fu
Starting Member

16 Posts

Posted - 2007-12-19 : 00:32:44
Scratch that, I tried it this way, but got a syntax error:

Syntax error. in query expression '(SELECT ISNULL(Sum(Game_Schedule.Score) FROM Game_Schedule WHERE Game_Schedule.T1_ID = standings.ID), 0) + (SELECT ISNULL(Sum(Game_Schedule.Opp_Score) FROM Game_Schedule WHERE Game_Schedule.T2_ID = standings.ID), 0)'.
Go to Top of Page

chien_fu
Starting Member

16 Posts

Posted - 2007-12-19 : 00:45:08
quote:
Originally posted by visakh16

try like this:-

(SELECT ISNULL(Sum(Game_Schedule.Score),0) FROM Game_Schedule WHERE Game_Schedule.T1_ID = standings.ID)
+
(SELECT ISNULL(Sum(Game_Schedule.Opp_Score),0) FROM Game_Schedule WHERE Game_Schedule.T2_ID = standings.ID)



Oh yeah when I try this it gives me this:

Wrong number of arguments used with function in query expression 'ISNULL(Sum(Game_Schedule.Score),0)'.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-12-19 : 00:54:46
Can you post the full query you used?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

chien_fu
Starting Member

16 Posts

Posted - 2007-12-19 : 01:12:37
I think I found my answer to this question.. looks like ACCESS requires something different,
more like:

IIF(x IS NULL, y, x)
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2007-12-19 : 01:25:59
This is SQL Server forum.Please post only SQL Server questions.
Go to Top of Page
   

- Advertisement -