Sql获取MAC地址软件注册实用

软件注册中,可以使用获取Sql服务器Mac来获得许可权。

取得Mac

declare  @dbid  int
set  @dbid=db_id( 'db_Stuey' )
select  distinct  hostname,
          db_name(dbid),
          net_address,
          loginame,
          program_name
from  master..sysprocesses   
where  hostname!= '' and (@dbid  is  null  or  dbid=@dbid) 
 
 
取得sa
declare @dbid int
set @dbid=db_id('數據庫名')
select distinct hostname,
         db_name(dbid),
         net_address, --物理地址
         loginame,
         program_name
from master..sysprocesses   
where hostname='服務器名'and(@dbid is null or dbid=@dbid)
 
 
 
可以使用最简单的方法,直接获取Sql服务器的Mac,一句话搞定!
select distinct net_address from master..sysprocesses where hostname!=''
 

 

你可能感兴趣的:(c#,sql)