IT Questions and Answers :)

Tuesday, February 25, 2020

When called without an argument, which of the following returns the SQL Server login of the current security context.

When called without an argument, which of the following returns the SQL Server login of the current security context.

  • ORIGINAL_LOGIN()
  • SUSER_SNAME()
  • USER_NAME()
  • SUSER_SID()
When called without an argument, which of the following returns the SQL Server login of the current security context.

EXPLANATION

SUSER_SNAME() - returns the login of the current security context.

ORIGINAL_LOGIN() - returns login of original connection context. It is not affected by context-switching.

USER_NAME() - returns the database user name of the current security context.

SUSER_SID() - Returns the Security Identifier (SID) of the current security context.

SQL Server has system-level logins and database users. While they often have the same username, they are distinct from one another. Logins are needed to gain access and set system-level permissions to SQL Server, while Users are needed for access and permissions to specific databases.

The current security context in SQL Server can be changed, known as context-switching or impersonation, with the use of the EXECUTE AS and REVERT statements in a script or batch.

Additional reading:
SQL Server Security Principals - https://docs.microsoft.com/en-us/sql/relational-databases/security/authentication-access/principals-database-engine?view=sql-server-2017
Context-switching - https://sqlity.net/en/1783/changing-security-context-execute-revert/

SOURCE

https://docs.microsoft.com/en-us/sql/t-sql/functions/security-functions-transact-sql?view=sql-server-2017
Share:

Related Posts:

0 comments:

Post a Comment

 On 30 september 2021, at 20:01, Dominick commented on which of following is not cloud
 On 20 july 2021, at 11:50, Anonymous commented on which of following is false about ddr2
 On 03 march 2021, at 13:49, Anonymous commented on which of following layers is layer 4 in
 On 02 january 2021, at 20:23, Anonymous commented on when open source software is used in
 On 30 october 2020, at 01:42, Anonymous commented on which of following is true regarding
 On 16 october 2020, at 18:27, Anonymous commented on which of following modules cannot be
 On 15 october 2020, at 13:54, Myles commented on in javascript which of following
 On 24 june 2020, at 05:50, Anonymous commented on in which layer of osi model would you
 On 26 may 2020, at 15:01, Myles commented on in javascript which of following
 On 24 february 2020, at 10:56, Anonymous commented on what is difference between tacacs and
 On 18 february 2020, at 11:56, Anonymous commented on what video conferencing application
 On 20 november 2019, at 18:18, Ranjitkumar commented on irq 1 is commonly assigned to the
 On 20 november 2019, at 12:36, RMS commented on irq 1 is commonly assigned to the
 On 06 september 2019, at 14:40, Ranjitkumar commented on what is acronym for management system
 On 06 september 2019, at 11:07, RMS commented on what is acronym for management system
 On 05 september 2019, at 00:48, Anonymous commented on how do you block user from opening
 On 27 august 2019, at 16:47, Anonymous commented on at what location in microsoft windows
 On 23 july 2019, at 22:31, Anonymous commented on in cryptography initialization vector
 On 17 july 2019, at 10:30, Anonymous commented on which of these is not use case of
 On 28 june 2019, at 06:38, Anonymous commented on which of following is not computer

Popular Posts