I couldn't find this function in the script library so I thought I'd add it. Very useful when comparing IP addresses and checking if an IP is within a certain range, etc. The technique is known, this is just a sql server implementation CREATE FUNCTION dbo.ip2num ( @ip varchar(15) )RETURNS bigintASBEGINDECLARE @num bigintSET @num = 256 * 256 * 256 * CAST(PARSENAME(@ip, 4) AS bigint) + 256 * 256 * CAST(PARSENAME(@ip, 3) AS bigint) + 256 * CAST(PARSENAME(@ip, 2) AS bigint) + CAST(PARSENAME(@ip, 1) AS bigint)RETURN @numEND
- LumbagoIf the facts don't fit the theory, change the facts. Albert Einstein