June 4, 2010 at 3:20 am
Hi,
I am Connected to LAN
In LAN 20 systems are there 10 systems with MS SQL Server installed
I am having Sample_Table in Sample_server
I need to find from which system Sample_table table is updated using Query window
Say if i am(SystemA) updating that table i need to insert it in another check_table
check_table will be having sno,ipaddress (i.e here my(SystemA) Ipaddress )
Say if i my frnd(SystemB) updating that table i need to insert it to check_table
check_table inserting sno,ipaddress (i.e here my frnd(SystemB) Ipaddress )
Can i find another system IPAddress using any trigger or something else
any solution for this is appreciated
Thanks
Parthi
Thanks
Parthi
June 4, 2010 at 5:55 am
Time ago I found this piece of code...
---------------------------------------------------------
-- HOW TO - Get SS IP ADDRESS
-- Credit to Eli Leiba
---------------------------------------------------------
-- You will need this procedure...
create Procedure sp_get_ip_address (@ip varchar(40) out)
as
begin
Declare @ipLine varchar(200)
Declare @pos int
set nocount on
set @ip = NULL
Create table #temp (ipLine varchar(200))
Insert #temp exec master..xp_cmdshell 'ipconfig'
select @ipLine = ipLine
from #temp
where upper (ipLine) like '%IP ADDRESS%'
if (isnull (@ipLine,'***') != '***')
begin
set @pos = CharIndex (':',@ipLine,1);
set @ip = rtrim(ltrim(substring (@ipLine ,
@pos + 1 ,
len (@ipLine) - @pos)))
end
drop table #temp
set nocount off
end
go
---------------------------------------------------------
-- How to use the procedure...
declare @ip varchar(40)
exec sp_get_ip_address @ip out
print @ip
---------------------------------------------------------
... hope it helps.
_____________________________________
Pablo (Paul) Berzukov
Author of Understanding Database Administration available at Amazon and other bookstores.
Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply