Thursday, June 5, 2014

How to find the IP Address of the client Machine in SQL Server 2008 R2


-- Check whether particular table exists in the database
if exists (select * from sys.objects where object_id = object_id(N'[#table]'))
begin
drop table #table
end
use tempdb
go
--Create the temp table #table
create table #table (IPValues varchar(200))
insert into #table exec master..xp_cmdshell 'ipconfig'
-- select the data from the table #table
select * from #table where IPValues is not null
-- You will get results like this



No comments:

Post a Comment