Joanne Pham wrote: > Thanks a lot for quick respond. > I would like to have the format as : 00:15:C5:F1:1D:45 > Please help me how to convert this number 224577687400448 to > this format 00:15:C5:F1:1D:45
This should do the trick. It's not pretty in SQL, and it might make more sense to do it in your application's programming language, but it does work. select substr('0123456789ABCDEF', ((mac >> 44) & 15) + 1, 1) || substr('0123456789ABCDEF', ((mac >> 40) & 15) + 1, 1) || ':' || substr('0123456789ABCDEF', ((mac >> 36) & 15) + 1, 1) || substr('0123456789ABCDEF', ((mac >> 32) & 15) + 1, 1) || ':' || substr('0123456789ABCDEF', ((mac >> 28) & 15) + 1, 1) || substr('0123456789ABCDEF', ((mac >> 24) & 15) + 1, 1) || ':' || substr('0123456789ABCDEF', ((mac >> 20) & 15) + 1, 1) || substr('0123456789ABCDEF', ((mac >> 16) & 15) + 1, 1) || ':' || substr('0123456789ABCDEF', ((mac >> 12) & 15) + 1, 1) || substr('0123456789ABCDEF', ((mac >> 8) & 15) + 1, 1) || ':' || substr('0123456789ABCDEF', ((mac >> 4) & 15) + 1, 1) || substr('0123456789ABCDEF', ((mac >> 0) & 15) + 1, 1) as 'MAC Address' from t; This assumes that the table t has an integer column mac that hods the mac address to be displayed. HTH Dennis Cote _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users