INF: You Cannot Use xp_loginconfig to Set Configuration Values (270716)



The information in this article applies to:

  • Microsoft SQL Server 7.0
  • Microsoft SQL Server 2000 (all editions)

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 "hostname" so that it would display the Windows NT user name instead of the computer name by running xp_loginconfig and setting "set hostname" 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 "set username as hostname" 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 "Using System Functions" and "xp_loginconfig" topics in Microsoft SQL Server Books Online.

You can find the functionality of the "set username as hostname" 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:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSSQLSERVER\MSSQLSERVER\sethostName = 1

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.

Modification Type:MajorLast Reviewed:10/17/2003
Keywords:kbinfo KB270716