Mausimo Mausimo - 1 year ago 444
SQL Question

what data-type to use to store MAC addresses in an SQL Server database table?

I want to store MAC addresses in one of my database tables, what data-type should I use? Reading articles on google, I have seen Binary(8) mentioned a few times. Is this the correct way?

Also, this does not make sense to me, as MAC addresses are six groups of two hexadecimal digits, wouldn't you use Binary(6)?

Answer Source

I wouldn't use Binary at all.

I would use CHAR(12).

Though this really depends on what you use the data for - if this is for display only, you can simply use the textual representation.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download