Actually, you can get rid of the @temp var, or not.
DECLARE
@myOctect varchar(32),
@i int,
@power int,
@result int
SET @myOctect = '00000101'
SET @power = len(@myoctect) - 1
SET @i = @power + 1
SET @result = 0
WHILE @i >= 1
BEGIN
SET @result = @result + substring(reverse(@myOctect),@i,1) *
Power(2,@power)
SET @i = @i - 1
SET @power = @power - 1
END
SELECT @result
Warmest Regards,
Phillip B. Holmes
http://phillipholmes.com
214-995-6175 (cell)
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.394 / Virus Database: 268.10.1/390 - Release Date: 7/17/2006
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:2514
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:6
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.6