# What does this percent sign do ?

What does this SQL statement do and how does the % sign work
I am trying to get an averrage time per call and this is what I came across in the  exsisting code.

,RIGHT('00'+CAST((SUM(ACD.talkTime)/COUNT(ACD.StartDateTime)%60) AS VARCHAR),2) AS [Avg_Talk_Time]
###### Who is Participating?

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Microsoft SQL Server Data DudeCommented:
modulo %, gives you the remainder of a division operation.

11 % 4 = 3, as it's two with three left over.
20 % 7 = 6, as it's two with six left over.

In the context of the T-SQL you posted, it looks like it's trying to just get the minute portion of ACD.StartDateTime.

Experts Exchange Solution brought to you by

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Microsoft SQL Server Data DudeCommented:
>CAST((SUM(ACD.talkTime)/COUNT(ACD.StartDateTime)%60)
Also looks like the parentheses marks are not correct, perhaps this should be..
``````RIGHT('00'+ CAST((SUM(ACD.talkTime)/COUNT(ACD.StartDateTime)) %60 AS VARCHAR(2)),2) AS [Avg_Talk_Time]
``````
Author Commented:
Yes the %b acts like a MOD giving the remander.  I did not know it did this with TIME values but i guess it does.   Thanks
Microsoft SQL Server Data DudeCommented: