Originally Posted on October 15, 2013 Last Updated on October 26, 2015
All information on this site is shared with the intention to help. Before any source code or program is ran on a production (non-development) system it is suggested you test it and fully understand what it is doing not just what it appears it is doing. I accept no responsibility for any damage you may do with this code.
UPDATE pageview SET pageview.IPLocation = ( SELECT TOP 1 (city + ‘, ‘ + region + ‘ ‘ + postalCode) FROM GeoCityLocation glcl INNER JOIN [GeoCityBlocks] glcb ON glcl.locId = glcb.locId WHERE ( pageview.[ipint] BETWEEN startIpNum AND endIpNum ) AND region = ‘MI’ ) WHERE url LIKE ‘%<URL>%’ AND IPLocation…
Recently I was asked to help convert Gregorian Date to Hijri Date and vice versa. One thing to note is that with Hijri date format you must keep it as a string. SELECT CONVERT(varchar(30), GETDATE(), 131) — Returns: 30/01/1435 8:33:10:030AM SELECT CONVERT(datetime, ’30/01/1435 8:32:19:467AM’, 131) — Returns: 2013-12-03 08:32:19.467 Originally…
This first function is helpful to provide a range of IPv4 addresses within a set range function New-IPRange ($start, $end) { # created by Dr. Tobias Weltner, MVP PowerShell $ip1 = ([System.Net.IPAddress]$start).GetAddressBytes() [Array]::Reverse($ip1) $ip1 = ([System.Net.IPAddress]($ip1 -join ‘.’)).Address $ip2 = ([System.Net.IPAddress]$end).GetAddressBytes() [Array]::Reverse($ip2) $ip2 = ([System.Net.IPAddress]($ip2 -join ‘.’)).Address for ($x=$ip1; $x…