I'm working on some code to convert some packed IP addresses out of an existing database. I have succeeded in creating a solution in Excel, but not getting consistent results with creating a TSQL function. While I can do it in Excel, I'm stubborn and want to figure this out. I've distilled this down to the following difference between the platforms:
--= MOD(-1062674156,256) = 20
--SELECT -1062674156 % 256 = -236
Excel 2013, SQL Server 2017 Standard
An explanation would be great, a fix would be even better! BTW the answer I'm getting with Excel is what I'm after (20)