Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 How to procure IP Address of Symtem ??

Author  Topic 

abhishek_kumar_rch
Starting Member

6 Posts

Posted - 2014-11-29 : 04:00:39
Hi,
I have created a user registration form
in which user have to fill Name,emil id, Phone Number.

In the back end i have created a table with the columns
name,email_id,Phone_number,Ip_address.


on button click event i have written this programming.
insert into tbl_login values (textbox1.text,textbox2.texttextbox3.text)

I would like to insert the value for IP address of the system of the user(who is doing registration.)

Please help me.

gbritton
Master Smack Fu Yak Hacker

2780 Posts

Posted - 2014-11-29 : 11:39:58
This function may work for you:

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
Go to Top of Page

gbritton
Master Smack Fu Yak Hacker

2780 Posts

Posted - 2014-11-29 : 11:40:53
Also, see this article: http://weblogs.sqlteam.com/peterl/archive/2010/03/20/Get-client-IP-address.aspx
Go to Top of Page
   

- Advertisement -