Joanne Pham wrote:
> Sorry! the conversion is correct but it is in reverse order.
> The select statement return :
> 1A:FC:90:48:30:00
>  
> and I checked the MAC Address:
>  
>  00:30:48:90:fc:1a
> How to change it to correct order or may be the number 29672054730752  needs 
> to be reverse.
> Once again thanks for the help,

Simply rearrange the order of the byte pairs.

     select
         substr('0123456789ABCDEF', ((mac >> 4) & 15) + 1, 1) ||
         substr('0123456789ABCDEF', ((mac >> 0) & 15) + 1, 1) ||
         ':' ||
         substr('0123456789ABCDEF', ((mac >> 12) & 15) + 1, 1) ||
         substr('0123456789ABCDEF', ((mac >> 8) & 15) + 1, 1) ||
         ':' ||
         substr('0123456789ABCDEF', ((mac >> 20) & 15) + 1, 1) ||
         substr('0123456789ABCDEF', ((mac >> 16) & 15) + 1, 1) ||
         ':' ||
         substr('0123456789ABCDEF', ((mac >> 28) & 15) + 1, 1) ||
         substr('0123456789ABCDEF', ((mac >> 24) & 15) + 1, 1) ||
         ':' ||
         substr('0123456789ABCDEF', ((mac >> 36) & 15) + 1, 1) ||
         substr('0123456789ABCDEF', ((mac >> 32) & 15) + 1, 1) ||
         ':' ||
         substr('0123456789ABCDEF', ((mac >> 44) & 15) + 1, 1) ||
         substr('0123456789ABCDEF', ((mac >> 40) & 15) + 1, 1)
         as 'MAC Address'
     from t;

Dennis Cote
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to