The round function requires 2 to 3 arguments

I’m very happy about finally being able to ask MS SQL questions instead of MS Access questions.

We’re using SQL Server 2008, and I’m having the following error:

The round function requires 2 to 3 arguments

The ROUND statement in my SQL looks like this:


SELECT ROUND( b.crit1_score * 2.222
	+ b.crit2_score * 2.222
        + b.crit3_score * 2.222
        + b.crit4_score * 2.222
       	+ b.crit5_score * 2.222
       	+ b.crit6_score * 2.222
        + b.crit7_score * 2.222
        + b.crit8_score * 2.222
        + b.crit9_score * 2.222 )
FROM scores AS b
WHERE b.judge_id = judgenom.judge_id
AND b.nom_id = judgenom.nom_id ) AS total_score

I’m thinking it’s because I have no records in this database yet, so the column values are null so the math is failing. Am I correct? If so, then why did this same thing work with an Access database?

Fixed!

ROUND needs a number to round, then the number of decimal places.

ROUND(number,decimal)

So I did this:

SELECT ROUND( b.crit1_score * 2.222
	+ b.crit2_score * 2.222
        + b.crit3_score * 2.222
        + b.crit4_score * 2.222
       	+ b.crit5_score * 2.222
       	+ b.crit6_score * 2.222
        + b.crit7_score * 2.222
        + b.crit8_score * 2.222
        + b.crit9_score * 2.222[COLOR="#FF0000"],2[/COLOR] )
FROM scores AS b
WHERE b.judge_id = judgenom.judge_id
AND b.nom_id = judgenom.nom_id ) AS total_score

And it works!