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 7714661
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T02:11:15+00:00 2026-06-01T02:11:15+00:00

I have a trigger for insert/update/delete. That is working fine. Also, I need the

  • 0

I have a trigger for insert/update/delete. That is working fine. Also, I need the client’s IP address from where the changes are made. That I need in T-SQL, that means, not in any web form but in the SQL/T-SQL while my trigger will get fired.

Also I go-ogled, and got that there is stored procedure in master database named xp_cmdshell which when executed with ipconfig we can get the IP Address. I think this will work only when you have administrative access to database. Mine hosting is a shared hosting , so I don’t have such privilege. Is there any other way out?

Please note: I don’t have administrative privileges on my SQL Server 2008 database. I need a solution as an authenticated user.

Another update:

I have got the solution, the query that will work for my scenario is

SELECT hostname, net_library, net_address
FROM sys.sysprocesses 
WHERE spid = @@SPID

It executes as needed but there is only one issue, that net_address is not in IP format. below is mine result:

hostname    net_library     net_address
IPC03       TCP/IP          AE8F925461DE  

I am eager to know:

  1. What is net_address here? Is is MAC Address or Some IP address etc?

  2. Is there any way to convert net_address to ip?

  • 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. Editorial Team
    Editorial Team
    2026-06-01T02:11:16+00:00Added an answer on June 1, 2026 at 2:11 am

    I found something which might work for you

    CREATE FUNCTION [dbo].[GetCurrentIP] ()
    RETURNS varchar(255)
    AS
    BEGIN
        DECLARE @IP_Address varchar(255);
    
        SELECT @IP_Address = client_net_address
        FROM sys.dm_exec_connections
        WHERE Session_id = @@SPID;
    
        Return @IP_Address;
    END
    

    From How to get Client IP Address in SQL Server

    Also have a look at this article about Get client IP address

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

Sidebar

Related Questions

I have a statement level trigger that fires whenever INSERT UPDATE or DELETE operations
I have an AFTER INSERT OR UPDATE OR DELETE trigger that I'm writing to
I have a stored procedure which is called inside a trigger on Insert/Update/Delete. The
I have a trigger that stores changes made in a separate table when a
I have a table that has a Trigger associated with it for Update, Insert
I have a trigger that executes a function on table insert or update. It
I have a rad grid where I can insert/update and delete items of data.
I have a function that is used as an INSERT trigger. This function deletes
I have 2 insert triggers, that fire on same table, they both try to
I have below trigger ALTER TRIGGER [dbo].[DeleteUserData] ON [dbo].[site_users] AFTER DELETE AS BEGIN SET

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.