David, This runs a little faster (removes the reverse() function from the loop). If you are recursively calling this over 20,000 records, that will help a bit.
DECLARE @myParam varchar(32), @myOctet varchar(32), @i int, @power int, @result int SET @myParam = '00111100' SET @myOctet = reverse(@myParam) SET @power = len(@myOctet) - 1 SET @i = @power + 1 SET @result = 0 WHILE @i >= 1 BEGIN SET @result = @result + substring(@myOctet,@i,1) * Power(2,@power) SET @i = @i - 1 SET @power = @power - 1 END SELECT @result ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/cf_lists/message.cfm/forumid:6/messageid:2519 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:6 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.6