?
Solved

10774: trigger DML- IP and  MAC address

Posted on 2014-10-17
3
Medium Priority
?
252 Views
Last Modified: 2014-10-17
In my table audit I keep the Ip and address of MAC of the machine that is running the application and those data to get from my web application and control as parameters in the procedure to insert into the table, in the case of Trigger, How could I get the IP and MAC?
0
Comment
Question by:enrique_aeo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 40

Assisted Solution

by:lcohan
lcohan earned 2000 total points
ID: 40387431
--IP:
SELECT client_net_address as IP_Address FROM sys.dm_exec_connections

--MAC:

SELECT hostname, net_library, net_address FROM sys.sysprocesses
where len(hostname)>0
0
 

Author Comment

by:enrique_aeo
ID: 40387442
but the mac address and IP must be the web application that connects, should not be the server, can not use the parameters sent from the web application on the trigger?
0
 
LVL 40

Accepted Solution

by:
lcohan earned 2000 total points
ID: 40387480
The two statements I posted above will return the IP and MAC address from the Client process (SPID) connected to SQL and I thought that's what you wanted to use in your trigger right?
For more details about those two DMViews you could check SQL BOL:

http://msdn.microsoft.com/en-us/library/ms181509.aspx
http://msdn.microsoft.com/en-us/library/ms179881.aspx
0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
Ready to get certified? Check out some courses that help you prepare for third-party exams.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

718 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question