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)
 HOST_NAME() on Terminal Server

Author  Topic 

noaksx3
Starting Member

1 Post

Posted - 2009-08-07 : 11:01:37
I am currently running a windows application with a SQL server 2008 back end. I am also running this application on a terminal server. The issue of course is that with everyone logged into the SQL server, you can't use the HOST_NAME() to get the name of the client as it will return the hostname of the terminal server instead. I am curious to see if anyone else has figured out a way to capture the hostname of the client WITHOUT passing it as a parameter. The idea here is that a trigger on a table runs whenever a record is modified to record the change in another table, but the hostname cannot get passed to it (unless you somehow add the hostname into the actual data table, then pull it from the [inserted] table in the trigger to use). I just can't think of a clean way to do this. Any ideas?

Nick

cat_jesus
Aged Yak Warrior

547 Posts

Posted - 2009-08-11 : 08:32:07
There's no clean way to do it. You could get the username and then query the terminal services server using wmi(I think).



An infinite universe is the ultimate cartesian product.
Go to Top of Page
   

- Advertisement -