SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Convert binary SID to string

By Todd Engen,

Functions such as SUSER_SID() return the binary represenation of the SID. fn_SIDToString converts the binary representation to the string format S-1-5-21-xxxx-yyyy-zzzz-aaaa.

Usage:

SELECT SUSER_NAME(), SUSER_SID(), dbo.fn_SIDToString(SUSER_SID())

Total article views: 3968 | Views in the last 30 days: 2
 
Related Articles
FORUM

SUSER_NAME() vs SUSER_SNAME()

Any reason to use one of the following over the other to return the user currently modifying data? ...

FORUM

SP4 Breaks Suser_sname() ?

Our admin folk just applied SQL 2000 SP4 on a W2K3 machine, and I noticed system function suser_snam...

FORUM

Obtain SUSER_SNAME in Replication

Hello, I have a vendor that is impossible to deal with, I'll just leave it at that. They won't al...

FORUM

Execution Plan Caching and SUSER_NAME()

Hi, I've got a data warehouse which is effectively a star schema. However, one of the dimensions ...

FORUM

SUSER_SNAME or SUSER_NAME in audit column (Azure SQL db)

Hi All, I would like to audit the update user name in an audit column in a table which is in Azur...

Tags
security    
sid    
 
Contribute