Generate a MAc adress with a stored procedure
-
Hi all, I would like to generate MAC addresses between a certain range in a stored procedure. The MAC addresses needed to be stored in a table. Any ideas? Suggestions?:thumbsup: I need something like below DECLARE @Max_MAC BINARY(8) DECLARE @StartRange BINARY(8) DECLARE @EndRange BINARY(8) DECLARE @MAC_Address BINARY(8) SET @StartRange = 0x00000004A500114B SET @EndRange = 0x00000004A50F11FF SELECT @Max_MAC = MAX(MAC_Address) FROM MAC_Address IF (@Max_Mac >= @StartRange and @Max_Mac < @EndRange) begin @Max_Mac = generate a higher macaddress INSERT INTO MAC_Address(MAC_Address,Timestamp) VALUES (@MAX_MAC, getdate()) END I do not know how I can count a number more to the MAcAdress I would like to become to a table with macadresses like 0x00000004A500114B 0x00000004A500114C 0x00000004A500114D ... Thanks in advance Tom Denys
-
Hi all, I would like to generate MAC addresses between a certain range in a stored procedure. The MAC addresses needed to be stored in a table. Any ideas? Suggestions?:thumbsup: I need something like below DECLARE @Max_MAC BINARY(8) DECLARE @StartRange BINARY(8) DECLARE @EndRange BINARY(8) DECLARE @MAC_Address BINARY(8) SET @StartRange = 0x00000004A500114B SET @EndRange = 0x00000004A50F11FF SELECT @Max_MAC = MAX(MAC_Address) FROM MAC_Address IF (@Max_Mac >= @StartRange and @Max_Mac < @EndRange) begin @Max_Mac = generate a higher macaddress INSERT INTO MAC_Address(MAC_Address,Timestamp) VALUES (@MAX_MAC, getdate()) END I do not know how I can count a number more to the MAcAdress I would like to become to a table with macadresses like 0x00000004A500114B 0x00000004A500114C 0x00000004A500114D ... Thanks in advance Tom Denys
:wtf: Mac address is the primary address of a Network Interface that uniquely identifies a PC. why you need to generate MAC Addresses ? If you need to generate unique id why not you use GUID s ... :confused:
Abhishek Sur
My Latest Articles **Create CLR objects in SQL Server 2005 C# Uncommon Keywords Read/Write Excel using OleDB
**Don't forget to click "Good Answer" if you like to.
-
Hi all, I would like to generate MAC addresses between a certain range in a stored procedure. The MAC addresses needed to be stored in a table. Any ideas? Suggestions?:thumbsup: I need something like below DECLARE @Max_MAC BINARY(8) DECLARE @StartRange BINARY(8) DECLARE @EndRange BINARY(8) DECLARE @MAC_Address BINARY(8) SET @StartRange = 0x00000004A500114B SET @EndRange = 0x00000004A50F11FF SELECT @Max_MAC = MAX(MAC_Address) FROM MAC_Address IF (@Max_Mac >= @StartRange and @Max_Mac < @EndRange) begin @Max_Mac = generate a higher macaddress INSERT INTO MAC_Address(MAC_Address,Timestamp) VALUES (@MAX_MAC, getdate()) END I do not know how I can count a number more to the MAcAdress I would like to become to a table with macadresses like 0x00000004A500114B 0x00000004A500114C 0x00000004A500114D ... Thanks in advance Tom Denys
Hi, Mac addresses are 8-byte (unsigned) numbers that typically get shown in hex with or without dashes in between bytes. You could hold their numeric value in a System.UInt64 (for .NET programming languages), show them with ToString("X16"), and handle them as NUMERIC in SQL according to this[^]. I think that beats the alternative of handling them as strings, since then you would have to implement some code to "hex increment" a string... BTW: I would rather not have to store a range of MAC addresses, unless I were a manufacturer of network equipment that is. :)
Luc Pattyn
Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.
Local announcement (Antwerp region): Lange Wapper? Neen!
-
:wtf: Mac address is the primary address of a Network Interface that uniquely identifies a PC. why you need to generate MAC Addresses ? If you need to generate unique id why not you use GUID s ... :confused:
Abhishek Sur
My Latest Articles **Create CLR objects in SQL Server 2005 C# Uncommon Keywords Read/Write Excel using OleDB
**Don't forget to click "Good Answer" if you like to.
I need to generate Mac address because we Program a Mac address in different kind of PCB's (like network cards) We want to trace the Mac address that we program in the PCB's. We get difefrent ranges that we use for that.