Unable to alter authorization on an mirroring endpoint to a login with a slash in the name

WePython 1 Months+

I am trying to run the following statement to alter the authorization on an endpoint as the current login used for authorization is about to be deleted (left the company).

alter authorization on endpoint::Mirroring to domain\sys-admin-group

We use Windows authentication, so all our server logins have the backslash "\" character in it.

Here is the error I received:

Msg 102, Level 15, State 1, Line 1
Incorrect syntax near '\'.

I have also tried to enclose the login in single quotes but received the following error:

Msg 102, Level 15, State 1, Line 1
Incorrect syntax near 'domain\sys-admin-group'.

I can't find any useful info on the MSDN ALTER AUTHORIZATION page (http://msdn.microsoft.com/en-us/library/ms187359.aspx). Any ideas?

-----------------Answer-----------------

Try surrounding it with the quoted identifier:

alter authorization 
on endpoint::Mirroring 
to [domain\sys-admin-group]

Notice the square brackets.


Previous : What units are 'reads' and 'writes' in dm_exec_query_stats
Next : How do I perform a UNION query on a dynamic list of tables?