sql server 2005 enterprise

how to see ip address
windows username
windows password
of my current connection



LVL 1
rgb192Asked:
Who is Participating?
 
sureshchsahuConnect With a Mentor Commented:
Instead of using sys.dm_exec_connections  u can also use the simple command

SELECT HOST_NAME() AS HostName, SUSER_NAME() LoggedInUser
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
the HOST_NAME function will give the ip address.
however, the windows username will only given "correctly" if the user logs in to sql server using windows authentication.
you CANNOT retrieve the windows password.
0
 
rgb192Author Commented:
what is the HOST_NAME function
0
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

 
Aneesh RetnakaranDatabase AdministratorCommented:
you wont be able to trace out the password ,

select * from master..sysprocesses  where spid = @@SPID

select * from sys.dm_exec_connections where session_id = @@SPID
0
 
chapmandewCommented:
slightly different way:

select * from sys.dm_exec_connections
where session_id = @@spid
0
 
rgb192Author Commented:
what is  @@SPID
0
 
chapmandewCommented:
nice work.  :)
0
 
chapmandewCommented:
@@spid is an internal sql function that returns your current SQL session ID
0
 
Aneesh RetnakaranDatabase AdministratorCommented:
>what is  @@SPID
it is the current session id
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
0
 
kkumar2dbaCommented:
Please use below

go to start -> run -> type cmd -> type hostname (on black screen)

this is will show the hostname.
0
 
sureshchsahuCommented:
if you want to see the IP Address from SQL do the following steps:

-- To enable the feature.
EXEC sp_configure 'xp_cmdshell', 1
GO
-- To update the currently configured value for this feature.
RECONFIGURE
GO
The above command will enable xp_cmdShell, by default it is disabled.

xp_cmdshell  'ipconfig /all'
0
 
sureshchsahuCommented:
If you are using SQL Server 2008 then do the below steps:

-- To allow advanced options to be changed.
EXEC sp_configure 'show advanced options', 1
GO
-- To update the currently configured value for advanced options.
RECONFIGURE
GO
-- To enable the feature.
EXEC sp_configure 'xp_cmdshell', 1
GO
-- To update the currently configured value for this feature.
RECONFIGURE
GO

xp_cmdshell  'ipconfig /all'
0
 
rgb192Author Commented:
its the one i used
0
 
chapmandewCommented:
seems like a split is more appropriate here.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.