Search code examples
sql-server-2008t-sqlsa

Is there a T-SQL function to return the name of the 'sa' account?


(I know the question sounds ridiculous, but bear with me ...)

Our DBA changes the 'sa' account name to something else for their own security purposes. There are business needs to use the account name in script (e.g. sp_add_job), but this will break in this situation. I'd like to be able to submit a script that doesn't need to be edited to use the new 'sa' username before running.

Is there a function/property similar to @@SERVERNAME that will return the name of this account?


Solution

  • Have you tried using:

    SELECT SUSER_NAME()