Monday, December 22, 2014

How to Get the logged in SQL User Name

Hi Dear All,

There is small in build function of SQL to get the logged in SQL User,

              SUSER_SNAME ( [ server_user_sid ] ) 
server_user_sid (Security Identification Number) is optional parameter for the function, it can be SQL Server Login or Windows User.
If this parameter is not passed it will result the currently logged in user name.

Use:
SUSER_SNAME can be used as DEFAULT constraint for the column values.



No comments: