17.06.2013 Views

Beginning Microsoft SQL Server 2008 ... - S3 Tech Training

Beginning Microsoft SQL Server 2008 ... - S3 Tech Training

Beginning Microsoft SQL Server 2008 ... - S3 Tech Training

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Appendix A: System Functions<br />

The SUSER_ID system function has long since been replaced by SUSER_SID, and remains in the product<br />

purely for backward compatibility purposes. Avoid using SUSER_ID, as the internal value it returns<br />

may change from server to server (the SID is much more reliable when you consider a database may be<br />

restored to a new server where a given login may have a different SUSER_ID).<br />

SUSER_NAME<br />

The SUSER_NAME function returns the specified user’s login ID name. The syntax is as follows:<br />

SUSER_NAME([])<br />

The server_user_id parameter is the specified user’s login ID number. If no value for<br />

server_user_id is provided, the default of the current user will be used instead.<br />

The SUSER_NAME system function is included in <strong>SQL</strong> <strong>Server</strong> 2000 for backward compatibility only, so<br />

if possible you should use SUSER_SNAME instead.<br />

SUSER_SID<br />

The SUSER_SID function returns the security identification number (SID) for the specified user. The syntax<br />

is as follows:<br />

SUSER_SID([‘’])<br />

The login parameter is the user’s login name. If no value for login is provided, the current user will be<br />

used instead.<br />

SUSER_SNAME<br />

The SUSER_SNAME function returns the login ID name for the specified security identification number<br />

(SID). The syntax is as follows:<br />

SUSER_SNAME([])<br />

The server_user_sid parameter is the user’s SID. If no value for the server_user_sid is provided,<br />

the current user’s will be used instead.<br />

USER<br />

The USER function allows a system-supplied value for the current user’s database username to be<br />

inserted into a table if no default has been supplied. The syntax is as follows:<br />

USER<br />

USER_ID<br />

632<br />

The USER_ID function returns the specified user’s database ID number. The syntax is as follows:<br />

USER_ID([‘’])

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!