• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 229
  • Last Modified:

sql server 2005 enterprise

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



0
rgb192
Asked:
rgb192
  • 4
  • 3
  • 3
  • +3
1 Solution
 
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
 
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
Restore individual SQL databases with ease

Veeam Explorer for Microsoft SQL Server delivers an easy-to-use, wizard-driven interface for restoring your databases from a backup. No expert SQL background required. Web interface provides a complete view of all available SQL databases to simplify the recovery of lost database

 
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
 
sureshchsahuCommented:
Instead of using sys.dm_exec_connections  u can also use the simple command

SELECT HOST_NAME() AS HostName, SUSER_NAME() LoggedInUser
0
 
rgb192Author Commented:
its the one i used
0
 
chapmandewCommented:
seems like a split is more appropriate here.
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

  • 4
  • 3
  • 3
  • +3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now