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
Solved

10774: trigger DML- IP and  MAC address

Posted on 2014-10-17
3
227 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 39

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 39

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Viewers will learn how the fundamental information of how to create a table.

856 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