Am writing av analytical standard solution register from the doping laboratory that i work for and got stuck on the problem how to get the ipaddress of the client in to the audit table.
I have found a straight forward method for actually get the ipaddress on the web and my question is not about that.
I got triggers on every table inserting records in to the audit table and I do not want to wright the inserting of the ipaddress manualy in every trigger. I would like to have something like a DEFAULT Constraint do the actual insertion of the ipaddress, but when I try I get errors about sub Queries not allowed.
Here is the way to get the address,
SELECT client_net_address
FROM sys.dm_exec_connections
WHERE (session_id = @@SPID)