Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. How to retrieve client IP address from sql server database

How to retrieve client IP address from sql server database

Scheduled Pinned Locked Moved Database
databasetutorialsql-serversysadmintools
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Tridip Bhattacharjee
    wrote on last edited by
    #1

    i need a script by which i can get client IP address from sql server database when people do DML operation on table. so i was looking for solution and i found a script which does the things fine from sql server 2005. here is the script

    CREATE FUNCTION [dbo].[GetCurrentIP] ()
    RETURNS varchar(255)
    AS
    BEGIN
    DECLARE @IP_Address varchar(255);

    SELECT @IP_Address = client_net_address
    FROM sys.dm_exec_connections
    WHERE Session_id = @@SPID;

    Return @IP_Address;
    END

    SELECT dbo.GetCurrentIP()

    but the above script do not work in sql server 2000. so i need a way to get client ip from sql server 2000. please guide. thanks

    tbhattacharjee

    H 1 Reply Last reply
    0
    • T Tridip Bhattacharjee

      i need a script by which i can get client IP address from sql server database when people do DML operation on table. so i was looking for solution and i found a script which does the things fine from sql server 2005. here is the script

      CREATE FUNCTION [dbo].[GetCurrentIP] ()
      RETURNS varchar(255)
      AS
      BEGIN
      DECLARE @IP_Address varchar(255);

      SELECT @IP_Address = client_net_address
      FROM sys.dm_exec_connections
      WHERE Session_id = @@SPID;

      Return @IP_Address;
      END

      SELECT dbo.GetCurrentIP()

      but the above script do not work in sql server 2000. so i need a way to get client ip from sql server 2000. please guide. thanks

      tbhattacharjee

      H Offline
      H Offline
      Herman T Instance
      wrote on last edited by
      #2

      Have you read this. Second answer in that thread tells you the options are very limited for IP retrieving in Sql Server 2000

      In Word you can only store 2 bytes. That is why I use Writer.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups