Microsoft KB Archive/270716

= INF: You Cannot Use xp_loginconfig to Set Configuration Values =

Article ID: 270716

Article Last Modified on 10/17/2003

-

APPLIES TO


 * Microsoft SQL Server 7.0 Standard Edition
 * Microsoft SQL Server 2000 Standard Edition

-



This article was previously published under Q270716



SUMMARY
In SQL Server 7.0 and SQL Server 2000, you cannot use xp_loginconfig to set configuration values. Therefore, you cannot change the sp_who stored procedure to display the Microsoft Windows NT user name instead of the computer name.

With Microsoft SQL Server 6.5 you could change the output of the sp_who &quot;hostname&quot; so that it would display the Windows NT user name instead of the computer name by running xp_loginconfig and setting &quot;set hostname&quot; to true. In SQL Server 7.0 and SQL Server 2000, because the login name is a real Windows NT domain login name, use of &quot;set username as hostname&quot; is unnecessary.



MORE INFORMATION
IMPORTANT: This article contains information about modifying the registry. Before you modify the registry, make sure to back it up and make sure that you understand how to restore the registry if a problem occurs. For information about how to back up, restore, and edit the registry, click the following article number to view the article in the Microsoft Knowledge Base:

256986 Description of the Microsoft Windows Registry

SQL Server 7.0 and SQL Server 2000 contain several system functions that return usernames and user IDs. For more information about these functions, see the &quot;Using System Functions&quot; and &quot;xp_loginconfig&quot; topics in Microsoft SQL Server Books Online.

You can find the functionality of the &quot;set username as hostname&quot; that existed in SQL Server 6.5 in the SQL Server 7.0 SUSER_SNAME function. Additionally, the SUSER_NAME function from SQL Server 6.5 is still present in SQL 7.0, and you can call the function to get the SQL Server login name or Windows NT account associated with a security_identifier. SUSER_NAME always returns NULL when used in SQL Server 2000. This system built-in function is included only for backward compatibility, so Microsoft suggests that you use SUSER_SNAME instead.

The HOST_NAME function returns the workstation name. You can influence the HOST_NAME system function by changing the following registry key value and setting the sethostName to TRUE:

After setting the sethostName value in the registry to true, the HOST_NAME system function returns the current username. However, sp_who still returns the computer name.

Additional query words: sp_who, system functions, xp_loginconfig, hostname

Keywords: kbinfo KB270716

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.