Solved

10774: trigger DML- IP and  MAC address

Posted on 2014-10-17
3
232 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
  • 2
3 Comments
 
LVL 40

Assisted Solution

by:lcohan
lcohan earned 500 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 500 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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQL Add Parameter in Variable 4 21
Regarding Disk IO 3 43
SQL syntax question 6 39
Running Total Using new MS SQL Function 21 50
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
I have a large data set and a SSIS package. How can I load this file in multi threading?
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

756 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