SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Retrive Client System name of IP
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

amirs
Constraint Violating Yak Guru

India
259 Posts

Posted - 05/29/2013 :  06:59:52  Show Profile  Reply with Quote
How retrieve client System name and IP address to connect sql server database?

visakh16
Very Important crosS Applying yaK Herder

India
52325 Posts

Posted - 05/29/2013 :  07:01:15  Show Profile  Reply with Quote
ipconfig from command prompt to get ip address

Client System name by right clicking my computer and from properties -> machine name

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

amirs
Constraint Violating Yak Guru

India
259 Posts

Posted - 05/29/2013 :  07:22:50  Show Profile  Reply with Quote
I have write a trigger of one table to insert record of one table to another table at this time i have insert client host name or ip address

i have insert a first table record using one application.

i have use host_name or SELECT client_net_address
FROM sys.dm_exec_connections
WHERE Session_id = @@SPID
but this return a server ip address or server name. i want to client ip or client system name to connected of my application within a trigger.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52325 Posts

Posted - 05/29/2013 :  07:46:25  Show Profile  Reply with Quote
oh ok for that use HOST_NAME() function and your query above for ip address

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

amirs
Constraint Violating Yak Guru

India
259 Posts

Posted - 05/29/2013 :  23:06:38  Show Profile  Reply with Quote
i can use this but it is return server name , i want to client machine name.
Go to Top of Page

russell
Pyro-ma-ni-yak

USA
5072 Posts

Posted - 05/29/2013 :  23:43:04  Show Profile  Visit russell's Homepage  Reply with Quote
quote:
Originally posted by amirs

i can use this but it is return server name , i want to client machine name.



No. HOST_NAME() returns client machine name.
Go to Top of Page

amirs
Constraint Violating Yak Guru

India
259 Posts

Posted - 05/29/2013 :  23:57:09  Show Profile  Reply with Quote
No its returns Machine Name, i have call in trigger
Go to Top of Page

amirs
Constraint Violating Yak Guru

India
259 Posts

Posted - 05/29/2013 :  23:59:16  Show Profile  Reply with Quote
No its returns SQL Server Machine Name, i have call in trigger
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52325 Posts

Posted - 05/30/2013 :  01:31:11  Show Profile  Reply with Quote
quote:
Originally posted by amirs

No its returns SQL Server Machine Name, i have call in trigger


what do you mean by SQL Server Machine name?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

amirs
Constraint Violating Yak Guru

India
259 Posts

Posted - 05/30/2013 :  02:07:46  Show Profile  Reply with Quote
its server name to installed sql server
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52325 Posts

Posted - 05/30/2013 :  02:11:01  Show Profile  Reply with Quote
quote:
Originally posted by amirs

its server name to installed sql server


where exactly are you executing this code from? Are you executing this from the same machine itself?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

amirs
Constraint Violating Yak Guru

India
259 Posts

Posted - 05/30/2013 :  02:20:48  Show Profile  Reply with Quote
No i have one front end application within this application i have insert a record of one table. i have write the trigger of this table.
the trigger is execute when insert record of table. i have write this code within trigger, so i want know which machine name is use this application to insert a record.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52325 Posts

Posted - 05/30/2013 :  02:34:03  Show Profile  Reply with Quote
hmm..in that case it might be probabaly worth capturing this in front end table used by application using HOST_NAME and in trigger just retrieve it from the table.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.09 seconds. Powered By: Snitz Forums 2000