Outputting mac address as standard format in mysql

After reading some research, I understand that mac addresses stored in mysql should be stored as BIG INT. Is there an easy way to output the mac's in the standard hex form: ab:23:a4:23:54:33 when using a SELECT statement?

I know I can use hex() to convert format to hexadecimal, but i'd like the full 6 bytes and colons. thanks.

Something like:

SELECT hex(macAddress) from <table>;

Answers


if you have your macAddress stored as a string you can use the following text conversion.

SELECT
    mac, concat(left(mac,2), ":",substring(mac,3,2), ":" , substring(mac,5,2),
     ":",substring(mac,7,2), ":",substring(mac,9,2), ":", 
    right(mac,2)) as mac_colons 
FROM mac_table;

Need Your Help

Can't step Into and debug the serviced component source code

c# visual-studio-2012 com+ servicedcomponent

I have developed a COM+ Component in C# be inheriting ServicedComponent.

JavaScript How to remove a child

javascript html removechild

Using javascript, I am adding two buttons, one will add a picture and the other will delete a picture. I'm just practicing for an exam...