Technical Article

MAC number from Query Analyzer

,

This procedure shows you the MAC number of your Enthernet
card in a format exactly the same as when running: ipconfig /all
from command shell. Updated thx to Larry A.

-----RETURN MAC------------
------updated-------------- 
---------------------------


Create procedure proc_MAC_number

AS

DECLARE @first char(2),
@second char(2),
@third char(2),
@fourth char(2), 
@fifth char(2), 
@sixth char(2) 

SELECT @first = substring(net_address,1,2),
  @second = substring(net_address,3,2),
  @third = substring(net_address,5,2),
  @fourth = substring(net_address,7,2),
  @fifth = substring(net_address,9,2),
  @sixth = substring(net_address,11,2)
FROM master..sysprocesses
WHERE spid = @@SPID

print @first + '-' + @second + '-' + @third + '-' + @fourth + '-' + @fifth + '-' + @sixth 

----Execution

EXEC proc_MAC_number

Rate

You rated this post out of 5. Change rating

Share

Share

Rate

You rated this post out of 5. Change rating