<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: SQL SERVER &#8211; Find Hostname and Current Logged In User Name</title>
	<atom:link href="http://blog.sqlauthority.com/2009/05/26/sql-server-find-hostname-and-current-logged-in-user-name/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sqlauthority.com/2009/05/26/sql-server-find-hostname-and-current-logged-in-user-name/</link>
	<description>SQL, SQL Server, MySQL, Big Data and NoSQL</description>
	<lastBuildDate>Wed, 19 Jun 2013 08:01:41 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: SQL SERVER &#8211; Weekly Series &#8211; Memory Lane &#8211; #031 &#124; Journey to SQL Authority with Pinal Dave</title>
		<link>http://blog.sqlauthority.com/2009/05/26/sql-server-find-hostname-and-current-logged-in-user-name/#comment-486718</link>
		<dc:creator><![CDATA[SQL SERVER &#8211; Weekly Series &#8211; Memory Lane &#8211; #031 &#124; Journey to SQL Authority with Pinal Dave]]></dc:creator>
		<pubDate>Sat, 01 Jun 2013 01:31:31 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=5166#comment-486718</guid>
		<description><![CDATA[[&#8230;] Find Hostname and Current Logged In User Name There are two tricks listed in this blog post where users can find out the hostname and current logged user name immediately and very easily. [&#8230;]]]></description>
		<content:encoded><![CDATA[<p>[&#8230;] Find Hostname and Current Logged In User Name There are two tricks listed in this blog post where users can find out the hostname and current logged user name immediately and very easily. [&#8230;]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vaishali</title>
		<link>http://blog.sqlauthority.com/2009/05/26/sql-server-find-hostname-and-current-logged-in-user-name/#comment-319294</link>
		<dc:creator><![CDATA[Vaishali]]></dc:creator>
		<pubDate>Thu, 26 Jul 2012 12:34:00 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=5166#comment-319294</guid>
		<description><![CDATA[Hi Pinal ,

How I can find the logs of Sql server ,when Username is same and hostname is different .]]></description>
		<content:encoded><![CDATA[<p>Hi Pinal ,</p>
<p>How I can find the logs of Sql server ,when Username is same and hostname is different .</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JS Arya</title>
		<link>http://blog.sqlauthority.com/2009/05/26/sql-server-find-hostname-and-current-logged-in-user-name/#comment-249402</link>
		<dc:creator><![CDATA[JS Arya]]></dc:creator>
		<pubDate>Tue, 07 Feb 2012 06:52:45 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=5166#comment-249402</guid>
		<description><![CDATA[Hi Pinal,

In one of my application i need IP address of the client from Sql server 2000. I know i can do xp_cmdshell but the user by which our application connects does not have rights. Any other way to get IP from sql server 2000 TSql?]]></description>
		<content:encoded><![CDATA[<p>Hi Pinal,</p>
<p>In one of my application i need IP address of the client from Sql server 2000. I know i can do xp_cmdshell but the user by which our application connects does not have rights. Any other way to get IP from sql server 2000 TSql?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jaffer</title>
		<link>http://blog.sqlauthority.com/2009/05/26/sql-server-find-hostname-and-current-logged-in-user-name/#comment-234740</link>
		<dc:creator><![CDATA[Jaffer]]></dc:creator>
		<pubDate>Tue, 10 Jan 2012 10:53:12 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=5166#comment-234740</guid>
		<description><![CDATA[how to show the message after updating in store procedure in sql 2008

EG:- Message as : Column value changed from XXXX to YYYY for the ZZZZ 
 
XXXX is the old value
YYYY is the new value
 
ZZZZ is for in which tab the value is changed. these both XXX,YYY and ZZZ  want to display after updatein..

Please give idea]]></description>
		<content:encoded><![CDATA[<p>how to show the message after updating in store procedure in sql 2008</p>
<p>EG:- Message as : Column value changed from XXXX to YYYY for the ZZZZ </p>
<p>XXXX is the old value<br />
YYYY is the new value</p>
<p>ZZZZ is for in which tab the value is changed. these both XXX,YYY and ZZZ  want to display after updatein..</p>
<p>Please give idea</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ArdentAj</title>
		<link>http://blog.sqlauthority.com/2009/05/26/sql-server-find-hostname-and-current-logged-in-user-name/#comment-219274</link>
		<dc:creator><![CDATA[ArdentAj]]></dc:creator>
		<pubDate>Fri, 16 Dec 2011 09:44:28 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=5166#comment-219274</guid>
		<description><![CDATA[How to get host name along with domain name in SQL .I have a SQL server installed in a machine named &quot;TestMachine.domain.com but when I use HOST_NAME or server property I am able to retrieve only &quot;TestMachine&quot;]]></description>
		<content:encoded><![CDATA[<p>How to get host name along with domain name in SQL .I have a SQL server installed in a machine named &#8220;TestMachine.domain.com but when I use HOST_NAME or server property I am able to retrieve only &#8220;TestMachine&#8221;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: madhivanan</title>
		<link>http://blog.sqlauthority.com/2009/05/26/sql-server-find-hostname-and-current-logged-in-user-name/#comment-180752</link>
		<dc:creator><![CDATA[madhivanan]]></dc:creator>
		<pubDate>Wed, 19 Oct 2011 10:15:34 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=5166#comment-180752</guid>
		<description><![CDATA[You can include HostName column as part of profiler result. Open the profiler goto File--&gt;Templates--&gt;Edit templates--&gt;Event selections--&gt;check show all columns--&gt;select HostName]]></description>
		<content:encoded><![CDATA[<p>You can include HostName column as part of profiler result. Open the profiler goto File&#8211;&gt;Templates&#8211;&gt;Edit templates&#8211;&gt;Event selections&#8211;&gt;check show all columns&#8211;&gt;select HostName</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: abhIShek online4all</title>
		<link>http://blog.sqlauthority.com/2009/05/26/sql-server-find-hostname-and-current-logged-in-user-name/#comment-179922</link>
		<dc:creator><![CDATA[abhIShek online4all]]></dc:creator>
		<pubDate>Mon, 17 Oct 2011 13:00:18 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=5166#comment-179922</guid>
		<description><![CDATA[Hi Pinal,

I got Clientprocessid (Host_ID) from sql profiler. how can i know the Host Name from that id?

Thanks in advance,
abhIShek Online4all]]></description>
		<content:encoded><![CDATA[<p>Hi Pinal,</p>
<p>I got Clientprocessid (Host_ID) from sql profiler. how can i know the Host Name from that id?</p>
<p>Thanks in advance,<br />
abhIShek Online4all</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Amar</title>
		<link>http://blog.sqlauthority.com/2009/05/26/sql-server-find-hostname-and-current-logged-in-user-name/#comment-177223</link>
		<dc:creator><![CDATA[Amar]]></dc:creator>
		<pubDate>Mon, 10 Oct 2011 17:44:38 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=5166#comment-177223</guid>
		<description><![CDATA[Hi Pinal... I&#039;m stuck in a scenario and hope to get some hint/help here. 

I have a shared login used by multiple users and someone dropped a table.

I want to identify - which IP dropped the table &amp; when? WHEN is important as compared to IP because the machine is in the cloud and people normally logon to the cloud server for access. If I can get IP of host computer, that is WOW!

Any help on this matter is highly appreciated.]]></description>
		<content:encoded><![CDATA[<p>Hi Pinal&#8230; I&#8217;m stuck in a scenario and hope to get some hint/help here. </p>
<p>I have a shared login used by multiple users and someone dropped a table.</p>
<p>I want to identify &#8211; which IP dropped the table &amp; when? WHEN is important as compared to IP because the machine is in the cloud and people normally logon to the cloud server for access. If I can get IP of host computer, that is WOW!</p>
<p>Any help on this matter is highly appreciated.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: madhivanan</title>
		<link>http://blog.sqlauthority.com/2009/05/26/sql-server-find-hostname-and-current-logged-in-user-name/#comment-172806</link>
		<dc:creator><![CDATA[madhivanan]]></dc:creator>
		<pubDate>Wed, 28 Sep 2011 12:00:08 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=5166#comment-172806</guid>
		<description><![CDATA[There are at least two options

1 Sp_who
2 Profiler]]></description>
		<content:encoded><![CDATA[<p>There are at least two options</p>
<p>1 Sp_who<br />
2 Profiler</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pavan K</title>
		<link>http://blog.sqlauthority.com/2009/05/26/sql-server-find-hostname-and-current-logged-in-user-name/#comment-172110</link>
		<dc:creator><![CDATA[Pavan K]]></dc:creator>
		<pubDate>Mon, 26 Sep 2011 12:13:17 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=5166#comment-172110</guid>
		<description><![CDATA[Hello Pinal:

Is it possible to know who are all accessed the DB, what were the queries they have ran? It should give the results from the DB creation time?]]></description>
		<content:encoded><![CDATA[<p>Hello Pinal:</p>
<p>Is it possible to know who are all accessed the DB, what were the queries they have ran? It should give the results from the DB creation time?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anil Kumar Kanojia</title>
		<link>http://blog.sqlauthority.com/2009/05/26/sql-server-find-hostname-and-current-logged-in-user-name/#comment-158593</link>
		<dc:creator><![CDATA[Anil Kumar Kanojia]]></dc:creator>
		<pubDate>Wed, 17 Aug 2011 22:34:30 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=5166#comment-158593</guid>
		<description><![CDATA[How to get the Server Name (SQLServer 2005) without installing SQLServer 2005 client (Query Analyser) i.e. without use of any SQL Query.]]></description>
		<content:encoded><![CDATA[<p>How to get the Server Name (SQLServer 2005) without installing SQLServer 2005 client (Query Analyser) i.e. without use of any SQL Query.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sreekumar</title>
		<link>http://blog.sqlauthority.com/2009/05/26/sql-server-find-hostname-and-current-logged-in-user-name/#comment-135248</link>
		<dc:creator><![CDATA[sreekumar]]></dc:creator>
		<pubDate>Thu, 19 May 2011 12:37:00 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=5166#comment-135248</guid>
		<description><![CDATA[how to get hostname and IP of a machine  on a citrix or remotedesktop environment on sql server

eg  i use a program hosted on citrix environment say excel to connect to my sql server and change some values . i want to know this user on this machine connected to the citrix server to connect to the database and make these changes. 

I created an audit trigger which is fired when any change is made to the table and it is properly recording the changes . the question is which machine/ ip address did the user use to login to citrix to do this task .

SELECT @@SPID AS &#039;ID&#039;, SYSTEM_USER AS &#039;Login Name&#039;, USER AS &#039;User Name&#039;, 

select  client_net_address,local_net_address 
from sys.dm_exec_connections where session_id=@@SPID

will still return citrix server how to get the user&#039;s computer]]></description>
		<content:encoded><![CDATA[<p>how to get hostname and IP of a machine  on a citrix or remotedesktop environment on sql server</p>
<p>eg  i use a program hosted on citrix environment say excel to connect to my sql server and change some values . i want to know this user on this machine connected to the citrix server to connect to the database and make these changes. </p>
<p>I created an audit trigger which is fired when any change is made to the table and it is properly recording the changes . the question is which machine/ ip address did the user use to login to citrix to do this task .</p>
<p>SELECT @@SPID AS &#8216;ID&#8217;, SYSTEM_USER AS &#8216;Login Name&#8217;, USER AS &#8216;User Name&#8217;, </p>
<p>select  client_net_address,local_net_address<br />
from sys.dm_exec_connections where session_id=@@SPID</p>
<p>will still return citrix server how to get the user&#8217;s computer</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Wallace Houston</title>
		<link>http://blog.sqlauthority.com/2009/05/26/sql-server-find-hostname-and-current-logged-in-user-name/#comment-117753</link>
		<dc:creator><![CDATA[Wallace Houston]]></dc:creator>
		<pubDate>Wed, 09 Feb 2011 17:21:10 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=5166#comment-117753</guid>
		<description><![CDATA[Good stuff.  Now that I know how to get the host_id, I want to send a message to the host calling the proc under certain situations.  I&#039;m on Server 08 and no &#039;Net Send&#039;.  I&#039;ve installed WinSentMessenger but haven&#039;t been able to make it send using SQL code.  Supposedly, WinSentMessenger is supposed to work with Net Send commands and using an XP box with Messenger started, the Net Send commands work.  

Email is not an option as the workstations calling the proc will not have email access.

Thanx, 
Wallace

DECLARE @hostid varchar(20) 
SET @hostid = (SELECT HOST_ID())
--print @hostid 
DECLARE @SQLmsg nvarchar(2000) 
SET @SQLmsg = &#039;net send&#039; + &#039; &#039; + @hostid + &#039; &#039; + &#039;my_message&#039;
exec xp_cmdshell @SQLmsg  --, no_output]]></description>
		<content:encoded><![CDATA[<p>Good stuff.  Now that I know how to get the host_id, I want to send a message to the host calling the proc under certain situations.  I&#8217;m on Server 08 and no &#8216;Net Send&#8217;.  I&#8217;ve installed WinSentMessenger but haven&#8217;t been able to make it send using SQL code.  Supposedly, WinSentMessenger is supposed to work with Net Send commands and using an XP box with Messenger started, the Net Send commands work.  </p>
<p>Email is not an option as the workstations calling the proc will not have email access.</p>
<p>Thanx,<br />
Wallace</p>
<p>DECLARE @hostid varchar(20)<br />
SET @hostid = (SELECT HOST_ID())<br />
&#8211;print @hostid<br />
DECLARE @SQLmsg nvarchar(2000)<br />
SET @SQLmsg = &#8216;net send&#8217; + &#8216; &#8216; + @hostid + &#8216; &#8216; + &#8216;my_message&#8217;<br />
exec xp_cmdshell @SQLmsg  &#8211;, no_output</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sambhu</title>
		<link>http://blog.sqlauthority.com/2009/05/26/sql-server-find-hostname-and-current-logged-in-user-name/#comment-102250</link>
		<dc:creator><![CDATA[sambhu]]></dc:creator>
		<pubDate>Fri, 26 Nov 2010 06:53:40 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=5166#comment-102250</guid>
		<description><![CDATA[Hello pinal,

I want to retrieve windows nt login name from sql query. My server is installed as mixed mode(sql server and windows).
Can you please tell me how can i get result?

Thanks
Sambhu]]></description>
		<content:encoded><![CDATA[<p>Hello pinal,</p>
<p>I want to retrieve windows nt login name from sql query. My server is installed as mixed mode(sql server and windows).<br />
Can you please tell me how can i get result?</p>
<p>Thanks<br />
Sambhu</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ron</title>
		<link>http://blog.sqlauthority.com/2009/05/26/sql-server-find-hostname-and-current-logged-in-user-name/#comment-86481</link>
		<dc:creator><![CDATA[Ron]]></dc:creator>
		<pubDate>Fri, 03 Sep 2010 14:52:47 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=5166#comment-86481</guid>
		<description><![CDATA[@Sushma Shah

Did you get the answer you need?]]></description>
		<content:encoded><![CDATA[<p>@Sushma Shah</p>
<p>Did you get the answer you need?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pascal</title>
		<link>http://blog.sqlauthority.com/2009/05/26/sql-server-find-hostname-and-current-logged-in-user-name/#comment-78304</link>
		<dc:creator><![CDATA[Pascal]]></dc:creator>
		<pubDate>Wed, 30 Jun 2010 14:02:14 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=5166#comment-78304</guid>
		<description><![CDATA[Thanks

 i find out with:

select HOST_NAME ()
select @@ServerName
and the Port with the configuration

But i have the following message when i try to connect to the database with Netbeans 6.9:

&quot;
Unable to add connection. Cannot establish a connection to
jdbc:sqlserver://Hostname\nom-de-ordinateur\SQLEXPRESS:1433; databaseName=Master using com.microsoft.sqlserver.jdbc.SQLServerdriver (The TCP/IP connection to the host has failed, java.net.ConnectionException: Connection refused: connect).
&quot;

Why? i don&#039;t know, please help-mE@

Th@nks]]></description>
		<content:encoded><![CDATA[<p>Thanks</p>
<p> i find out with:</p>
<p>select HOST_NAME ()<br />
select @@ServerName<br />
and the Port with the configuration</p>
<p>But i have the following message when i try to connect to the database with Netbeans 6.9:</p>
<p>&#8221;<br />
Unable to add connection. Cannot establish a connection to<br />
jdbc:sqlserver://Hostname\nom-de-ordinateur\SQLEXPRESS:1433; databaseName=Master using com.microsoft.sqlserver.jdbc.SQLServerdriver (The TCP/IP connection to the host has failed, java.net.ConnectionException: Connection refused: connect).<br />
&#8221;</p>
<p>Why? i don&#8217;t know, please help-mE@</p>
<p>Th@nks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pascal</title>
		<link>http://blog.sqlauthority.com/2009/05/26/sql-server-find-hostname-and-current-logged-in-user-name/#comment-78299</link>
		<dc:creator><![CDATA[Pascal]]></dc:creator>
		<pubDate>Wed, 30 Jun 2010 13:23:29 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=5166#comment-78299</guid>
		<description><![CDATA[Hello,
i&#039;m new in programming.
i&#039;m trying to connect to SQL Server Management Studio with NetBeans 6.9 but where could i find :
-Host name?
-Port?
-instance name?

Thank you
SEG]]></description>
		<content:encoded><![CDATA[<p>Hello,<br />
i&#8217;m new in programming.<br />
i&#8217;m trying to connect to SQL Server Management Studio with NetBeans 6.9 but where could i find :<br />
-Host name?<br />
-Port?<br />
-instance name?</p>
<p>Thank you<br />
SEG</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sushma Shah</title>
		<link>http://blog.sqlauthority.com/2009/05/26/sql-server-find-hostname-and-current-logged-in-user-name/#comment-77922</link>
		<dc:creator><![CDATA[Sushma Shah]]></dc:creator>
		<pubDate>Mon, 28 Jun 2010 16:24:14 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=5166#comment-77922</guid>
		<description><![CDATA[Hi everyone,
 I am trying to run an update script on several databases. The condition is I can only run the script if there is no user connected to the database. I have tried using the sysprocesses and doing count of the spid. But it&#039;s not working. Any help is appreciated.
Thanks,
Sushma]]></description>
		<content:encoded><![CDATA[<p>Hi everyone,<br />
 I am trying to run an update script on several databases. The condition is I can only run the script if there is no user connected to the database. I have tried using the sysprocesses and doing count of the spid. But it&#8217;s not working. Any help is appreciated.<br />
Thanks,<br />
Sushma</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paul Oster</title>
		<link>http://blog.sqlauthority.com/2009/05/26/sql-server-find-hostname-and-current-logged-in-user-name/#comment-65732</link>
		<dc:creator><![CDATA[Paul Oster]]></dc:creator>
		<pubDate>Tue, 20 Apr 2010 15:30:30 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=5166#comment-65732</guid>
		<description><![CDATA[Using SQL Server 2000, I only find that
SELECT SYSTEM_USER identifies the current logged in user.
None of the queries above work for me.]]></description>
		<content:encoded><![CDATA[<p>Using SQL Server 2000, I only find that<br />
SELECT SYSTEM_USER identifies the current logged in user.<br />
None of the queries above work for me.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hari</title>
		<link>http://blog.sqlauthority.com/2009/05/26/sql-server-find-hostname-and-current-logged-in-user-name/#comment-64956</link>
		<dc:creator><![CDATA[Hari]]></dc:creator>
		<pubDate>Sat, 10 Apr 2010 02:50:08 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=5166#comment-64956</guid>
		<description><![CDATA[While connecting through a ssh tunnel that tunnels localhost:1433 to remotehost:1433 through host2, &quot;select host_name()&quot; returned &quot;localhost&quot; instead of &quot;remotehost&quot;. However, SERVERPROPERTY(&#039;MachineName&#039;) returned the correct value.]]></description>
		<content:encoded><![CDATA[<p>While connecting through a ssh tunnel that tunnels localhost:1433 to remotehost:1433 through host2, &#8220;select host_name()&#8221; returned &#8220;localhost&#8221; instead of &#8220;remotehost&#8221;. However, SERVERPROPERTY(&#8216;MachineName&#8217;) returned the correct value.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jorge</title>
		<link>http://blog.sqlauthority.com/2009/05/26/sql-server-find-hostname-and-current-logged-in-user-name/#comment-64234</link>
		<dc:creator><![CDATA[Jorge]]></dc:creator>
		<pubDate>Thu, 01 Apr 2010 14:05:01 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=5166#comment-64234</guid>
		<description><![CDATA[Hi Pinal,

Is there a way to change a hostname connection string from a active connection?

For example:
I have a unique login into the SQL Server that it&#039;s used by my aplication. So, I have a lot of connections ( ... count(*) from sys.sysprocesses ... ) with the same strings, like below...

spid   ecid   status                         loginame                                                                                                                     hostname                                                                                                                         blk   dbname                                                                                                                           cmd              request_id
------ ------ ------------------------------ ---------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------- ----- -------------------------------------------------------------------------------------------------------------------------------- ---------------- -----------
105    0      sleeping                       appuser_0027                                                                                                                 ares13                                                                                                                           0     dados                                                                                                                            AWAITING COMMAND 0
110    0      sleeping                       appuser_0027                                                                                                                 ares13                                                                                                                           0     dados                                                                                                                            AWAITING COMMAND 0
184    0      sleeping                       appuser_0027                                                                                                                 ares13                                                                                                                           0     dados                                                                                                                            AWAITING COMMAND 0
185    0      sleeping                       appuser_0027                                                                                                                 ares13                                                                                                                           0     dados                                                                                                                            AWAITING COMMAND 0
186    0      sleeping                       appuser_0027                                                                                                                 ares13                                                                                                                           0     dados                                                                                                                            AWAITING COMMAND 0
187    0      sleeping                       appuser_0027                                                                                                                 ares13                                                                                                                           0     dados                                                                                                                            AWAITING COMMAND 0
195    0      sleeping                       appuser_0027                                                                                                                 ares13                                                                                                                           0     dados                                                                                                                            AWAITING COMMAND 0
202    0      sleeping                       appuser_0027                                                                                                                 ares13                                                                                                                           0     dados                                                                                                                            AWAITING COMMAND 0
203    0      sleeping                       appuser_0027                                                                                                                 ares13                                                                                                                           0     dados                                                                                                                            AWAITING COMMAND 0
259    0      sleeping                       appuser_0027                                                                                                                 ares13                                                                                                                           0     dados                                                                                                                            AWAITING COMMAND 0

This way, I cannot know who is under each connections/processes (local machine or people).

Best Regards...

Jorge Silva / Brazil.]]></description>
		<content:encoded><![CDATA[<p>Hi Pinal,</p>
<p>Is there a way to change a hostname connection string from a active connection?</p>
<p>For example:<br />
I have a unique login into the SQL Server that it&#8217;s used by my aplication. So, I have a lot of connections ( &#8230; count(*) from sys.sysprocesses &#8230; ) with the same strings, like below&#8230;</p>
<p>spid   ecid   status                         loginame                                                                                                                     hostname                                                                                                                         blk   dbname                                                                                                                           cmd              request_id<br />
&#8212;&#8212; &#8212;&#8212; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; &#8212;&#8211; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; &#8212;&#8212;&#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;&#8211;<br />
105    0      sleeping                       appuser_0027                                                                                                                 ares13                                                                                                                           0     dados                                                                                                                            AWAITING COMMAND 0<br />
110    0      sleeping                       appuser_0027                                                                                                                 ares13                                                                                                                           0     dados                                                                                                                            AWAITING COMMAND 0<br />
184    0      sleeping                       appuser_0027                                                                                                                 ares13                                                                                                                           0     dados                                                                                                                            AWAITING COMMAND 0<br />
185    0      sleeping                       appuser_0027                                                                                                                 ares13                                                                                                                           0     dados                                                                                                                            AWAITING COMMAND 0<br />
186    0      sleeping                       appuser_0027                                                                                                                 ares13                                                                                                                           0     dados                                                                                                                            AWAITING COMMAND 0<br />
187    0      sleeping                       appuser_0027                                                                                                                 ares13                                                                                                                           0     dados                                                                                                                            AWAITING COMMAND 0<br />
195    0      sleeping                       appuser_0027                                                                                                                 ares13                                                                                                                           0     dados                                                                                                                            AWAITING COMMAND 0<br />
202    0      sleeping                       appuser_0027                                                                                                                 ares13                                                                                                                           0     dados                                                                                                                            AWAITING COMMAND 0<br />
203    0      sleeping                       appuser_0027                                                                                                                 ares13                                                                                                                           0     dados                                                                                                                            AWAITING COMMAND 0<br />
259    0      sleeping                       appuser_0027                                                                                                                 ares13                                                                                                                           0     dados                                                                                                                            AWAITING COMMAND 0</p>
<p>This way, I cannot know who is under each connections/processes (local machine or people).</p>
<p>Best Regards&#8230;</p>
<p>Jorge Silva / Brazil.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anne</title>
		<link>http://blog.sqlauthority.com/2009/05/26/sql-server-find-hostname-and-current-logged-in-user-name/#comment-55652</link>
		<dc:creator><![CDATA[Anne]]></dc:creator>
		<pubDate>Mon, 07 Sep 2009 02:46:36 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=5166#comment-55652</guid>
		<description><![CDATA[Hi Pinal,
Like Vishwa I am looking at getting either the windows username or the computer name of the user. My front end is an Access adp, and I get the above information using Environ(&quot;USERNAME&quot;) and Environ(&quot;COMPUTERNAME&quot;), but I don&#039;t know how to get it from SQL server to use it in a trigger.
Thanks for your help]]></description>
		<content:encoded><![CDATA[<p>Hi Pinal,<br />
Like Vishwa I am looking at getting either the windows username or the computer name of the user. My front end is an Access adp, and I get the above information using Environ(&#8220;USERNAME&#8221;) and Environ(&#8220;COMPUTERNAME&#8221;), but I don&#8217;t know how to get it from SQL server to use it in a trigger.<br />
Thanks for your help</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: vishwa</title>
		<link>http://blog.sqlauthority.com/2009/05/26/sql-server-find-hostname-and-current-logged-in-user-name/#comment-55618</link>
		<dc:creator><![CDATA[vishwa]]></dc:creator>
		<pubDate>Sat, 05 Sep 2009 11:44:44 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=5166#comment-55618</guid>
		<description><![CDATA[hi,
can any one please help me out in  getting windows username when logged into server (Server Authentication)]]></description>
		<content:encoded><![CDATA[<p>hi,<br />
can any one please help me out in  getting windows username when logged into server (Server Authentication)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: hkjhkas</title>
		<link>http://blog.sqlauthority.com/2009/05/26/sql-server-find-hostname-and-current-logged-in-user-name/#comment-54702</link>
		<dc:creator><![CDATA[hkjhkas]]></dc:creator>
		<pubDate>Mon, 10 Aug 2009 22:51:47 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=5166#comment-54702</guid>
		<description><![CDATA[Pinal, 
We can use Serverproperty(&#039;MachineName&#039;) to see exactly which server you are connected to. And when we run above query it will give my laptop name whichever server I connected.]]></description>
		<content:encoded><![CDATA[<p>Pinal,<br />
We can use Serverproperty(&#8216;MachineName&#8217;) to see exactly which server you are connected to. And when we run above query it will give my laptop name whichever server I connected.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Imran Mohammed</title>
		<link>http://blog.sqlauthority.com/2009/05/26/sql-server-find-hostname-and-current-logged-in-user-name/#comment-53781</link>
		<dc:creator><![CDATA[Imran Mohammed]]></dc:creator>
		<pubDate>Fri, 17 Jul 2009 04:54:00 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=5166#comment-53781</guid>
		<description><![CDATA[CREATE PROC USP_CHECK_DATABASE_ROLE_USERS
AS
SET NOCOUNT ON
CREATE TABLE #TEMP1 ( UID INT, NAME SYSNAME)
CREATE TABLE #TEMP2 ( ID INT IDENTITY ,UID INT, NAME SYSNAME)
CREATE TABLE #TEMP3 ( USER_NAMES SYSNAME, ROLE_NAMES SYSNAME)
INSERT INTO #TEMP1 SELECT UID, NAME  FROM SYSUSERS WHERE SID NOT IN (0X00 , 0X01) AND SID IS NOT NULL
INSERT INTO #TEMP2 SELECT UID, NAME FROM SYSUSERS WHERE SID IS NULL
INSERT INTO #TEMP3 SELECT A.NAME USER_NAMES , B.NAME ROLE_NAMES  FROM #TEMP1 A, #TEMP2 B , SYSMEMBERS C WHERE A.UID = MEMBERUID AND B.UID =GROUPUID  

DECLARE @VAR INT
DECLARE @VAR2 VARCHAR(128)
DECLARE @CMD VARCHAR(8000)

SET @VAR = 1
SET @CMD = &#039;SELECT USER_NAMES,&#039;
WHILE @VAR &lt; = ( SELECT COUNT(*) FROM #TEMP2 )
	BEGIN
	SELECT @VAR2 = NAME FROM #TEMP2 WHERE ID = @VAR
	
	IF @VAR =1
	  BEGIN 
          SET @CMD = @CMD + &#039; MAX(CASE ROLE_NAMES WHEN &#039;+&#039;&#039;&#039;&#039;+@VAR2+&#039;&#039;&#039;&#039; +&#039; THEN &#039;&#039;Y&#039;&#039; ELSE &#039;&#039;X&#039;&#039; END ) AS [&#039;+UPPER(@VAR2)+ &#039;]&#039;
	END
	
        IF @VAR  1 AND @VAR  ( SELECT COUNT(*) FROM #TEMP2)-1
	  BEGIN
	  SET @CMD = @CMD +&#039; , &#039; + &#039; MAX(CASE ROLE_NAMES WHEN &#039;+&#039;&#039;&#039;&#039;+@VAR2+&#039;&#039;&#039;&#039; +&#039; THEN &#039;&#039;Y&#039;&#039; ELSE &#039;&#039;X&#039;&#039; END ) AS [&#039;+UPPER(@VAR2)+ &#039;]&#039;
	END
	
	IF @VAR = ( SELECT COUNT(*) FROM #TEMP2)
	  BEGIN
	  SET @CMD = @CMD +&#039; , &#039; + &#039; MAX(CASE ROLE_NAMES WHEN &#039;+&#039;&#039;&#039;&#039;+@VAR2+&#039;&#039;&#039;&#039; +&#039; THEN &#039;&#039;Y&#039;&#039; ELSE &#039;&#039;X&#039;&#039; END ) AS [&#039;+UPPER(@VAR2)+ &#039;]&#039;+&#039; FROM #TEMP3 GROUP BY USER_NAMES &#039;
	END
	SET @VAR = @VAR+ 1
END
EXEC (@CMD)
DROP TABLE #TEMP1
DROP TABLE #TEMP2
DROP TABLE #TEMP3 
SET NOCOUNT OFF]]></description>
		<content:encoded><![CDATA[<p>CREATE PROC USP_CHECK_DATABASE_ROLE_USERS<br />
AS<br />
SET NOCOUNT ON<br />
CREATE TABLE #TEMP1 ( UID INT, NAME SYSNAME)<br />
CREATE TABLE #TEMP2 ( ID INT IDENTITY ,UID INT, NAME SYSNAME)<br />
CREATE TABLE #TEMP3 ( USER_NAMES SYSNAME, ROLE_NAMES SYSNAME)<br />
INSERT INTO #TEMP1 SELECT UID, NAME  FROM SYSUSERS WHERE SID NOT IN (0X00 , 0X01) AND SID IS NOT NULL<br />
INSERT INTO #TEMP2 SELECT UID, NAME FROM SYSUSERS WHERE SID IS NULL<br />
INSERT INTO #TEMP3 SELECT A.NAME USER_NAMES , B.NAME ROLE_NAMES  FROM #TEMP1 A, #TEMP2 B , SYSMEMBERS C WHERE A.UID = MEMBERUID AND B.UID =GROUPUID  </p>
<p>DECLARE @VAR INT<br />
DECLARE @VAR2 VARCHAR(128)<br />
DECLARE @CMD VARCHAR(8000)</p>
<p>SET @VAR = 1<br />
SET @CMD = &#8216;SELECT USER_NAMES,&#8217;<br />
WHILE @VAR &lt; = ( SELECT COUNT(*) FROM #TEMP2 )<br />
	BEGIN<br />
	SELECT @VAR2 = NAME FROM #TEMP2 WHERE ID = @VAR</p>
<p>	IF @VAR =1<br />
	  BEGIN<br />
          SET @CMD = @CMD + &#039; MAX(CASE ROLE_NAMES WHEN &#039;+&#039;&#039;&#039;&#039;+@VAR2+&#039;&#039;&#039;&#039; +&#039; THEN &#039;&#039;Y&#039;&#039; ELSE &#039;&#039;X&#039;&#039; END ) AS [&#039;+UPPER(@VAR2)+ &#039;]&#039;<br />
	END</p>
<p>        IF @VAR  1 AND @VAR  ( SELECT COUNT(*) FROM #TEMP2)-1<br />
	  BEGIN<br />
	  SET @CMD = @CMD +&#8217; , &#8216; + &#8216; MAX(CASE ROLE_NAMES WHEN &#8216;+&#8221;&#8221;+@VAR2+&#8221;&#8221; +&#8217; THEN &#8221;Y&#8221; ELSE &#8221;X&#8221; END ) AS ['+UPPER(@VAR2)+ ']&#8216;<br />
	END</p>
<p>	IF @VAR = ( SELECT COUNT(*) FROM #TEMP2)<br />
	  BEGIN<br />
	  SET @CMD = @CMD +&#8217; , &#8216; + &#8216; MAX(CASE ROLE_NAMES WHEN &#8216;+&#8221;&#8221;+@VAR2+&#8221;&#8221; +&#8217; THEN &#8221;Y&#8221; ELSE &#8221;X&#8221; END ) AS ['+UPPER(@VAR2)+ ']&#8216;+&#8217; FROM #TEMP3 GROUP BY USER_NAMES &#8216;<br />
	END<br />
	SET @VAR = @VAR+ 1<br />
END<br />
EXEC (@CMD)<br />
DROP TABLE #TEMP1<br />
DROP TABLE #TEMP2<br />
DROP TABLE #TEMP3<br />
SET NOCOUNT OFF</p>
]]></content:encoded>
	</item>
</channel>
</rss>
