Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 147863
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T08:51:22+00:00 2026-05-11T08:51:22+00:00

My work company has a MSSQL server 2005. I have two questions about finding

  • 0

My work company has a MSSQL server 2005. I have two questions about finding out current log user and any way to send out a warning message:

First question is if there is any T-SQL or SP available to find out current login user name and machine name. If the user is using SQL server sa name to remotely access to SQL server, is there any way to find out that user’s windows name (the name to log to the windows)?

My next question is that if I can get the user name or id, is there any way to send out a warning message such as ‘currently SQL server is clean up or backup, please do not log in at this time’. I guess it may be difficult. I may have to send an email out to the user.

The SQL server is only accessible in the company. The SQL server has a list of users as login users: windows users, SQL users and sa.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T08:51:23+00:00Added an answer on May 11, 2026 at 8:51 am
    SELECT SUSER_SNAME(), HOST_NAME() 

    If the connection is ‘sa’ (or any other SQL login) then you can’t find the domain/windows user name. SQL Server only knows it’s ‘sa’ or that SQL login.

    HOST_NAME may not be reliable either, it can be set in the connection string (‘Application Name’). Or it could be vague eg ‘Microsoft Office’ for by default for Access, Excel etc

    You could backtrack via client_net_address in sys.dm_exec_connections and match MAC address to IP and find out who is logged on…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The company I used to work with has two developers working fulltime, and a
I work at a company that has some very non-standardized SQL conventions (They were
I currently work at a company that has a lot of custom applications that
The company I work for has recently been hit with many header injection and
The company I work for has several clients. I'm currently splitting my time between
The company I work for has a large webapp written in C++ as an
The company I work for has historically had very little process as far as
I work for a small marketing company that has asked me to develop a
The company I work for makes hardware that communicates to the computer though a
The company I work for is wanting to add blog functionality to our website

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.