May 22, 2017 at 4:03 pm
I have a stored procedure that has a calculation the looks like this:
[Total Minutes] = SUM(CONVERT(INT, CEILING(DATEDIFF(SECOND, CallStartUTC, CallEndUTC) / $60))),
I have never seen a $ used like this and was wondering what it does. If I take the $ out, every result is 0, but if I leave it in everything looks normal.
I searched all over but most search engines don't work well when looking for $ usage.
May 22, 2017 at 4:27 pm
When I just select $60:
It looks as though it casts it as smallmoney.
May 22, 2017 at 4:44 pm
$20 is a literal of the data type money/smallmoney, because they're the only data types that can have a currency symbol in front, just like 10.0 would be a literal of the type numeric/decimal/float (can't remember exactly which one)
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
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply