Thursday, September 29, 2005

SYSTEM_USER

Allows a system-supplied value for the current system username to be inserted into a table when no default value is specified.

DECLARE @sys_usr char(30)
SET @sys_usr = SYSTEM_USER
SELECT 'The current system user is: '+ @sys_usr
GO
Here is the result set:
----------------------------------------------------------
The current system user is: sa

(1 row(s) affected)

No comments: