Solved

10774: trigger DML- IP and  MAC address

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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

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…
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 how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

752 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