tag:blogger.com,1999:blog-497787815177352569.post1943900296617185119..comments2024-01-03T08:55:04.827-05:00Comments on SQL Anywhere: Get MAC Addresses Via SQLBreck Carterhttp://www.blogger.com/profile/15975598564711761434noreply@blogger.comBlogger3125tag:blogger.com,1999:blog-497787815177352569.post-74016924446812806182009-02-23T11:59:00.000-05:002009-02-23T11:59:00.000-05:00Thanks for the correction.I never claimed *I* knew...Thanks for the correction.<BR/>I never claimed *I* knew regular expressions, only that *you* could use one.Jasonhttps://www.blogger.com/profile/12145882163603100117noreply@blogger.comtag:blogger.com,1999:blog-497787815177352569.post-21800080941277971852009-02-23T01:39:00.000-05:002009-02-23T01:39:00.000-05:00Works great! if...- xp_cmdshell hasn't been droppe...Works great! if...<BR/><BR/>- xp_cmdshell hasn't been dropped from the database for security reasons <BR/><BR/>- the folder c:\temp exists<BR/><BR/>- you add the line set ipinfo = xp_read_file ( 'c:\\temp\\ip.dat' );<BR/><BR/>Everybody stand back! <A HREF="http://store.xkcd.com/#RegularExpressionsShirt" REL="nofollow">Biff knows regular expressions!</A>Breck Carterhttps://www.blogger.com/profile/15975598564711761434noreply@blogger.comtag:blogger.com,1999:blog-497787815177352569.post-69540392209413264032009-02-22T20:56:00.000-05:002009-02-22T20:56:00.000-05:00I think this would also work on any machine that a...I think this would also work on any machine that actually has ipconfig.exe:<BR/><BR/> create variable ipinfo long varchar;<BR/> select xp_cmdshell( 'ipconfig /all > c:\\temp\\ip.dat' );<BR/> select substring( ipinfo, locate( ipinfo, 'physical address', 1 ) + 36, 17) as mac_address from dummy;<BR/><BR/>If you had multiple network cards, you would have to use a loop, but on Windows this should work.<BR/>Of course, you could also use a fancy regular expression to process the ipconfig output...Jasonhttps://www.blogger.com/profile/12145882163603100117noreply@blogger.com