3

I want to alter a credential on my SQL Server install. It was auto-generated when I set up a replication publication to be used with the replication transaction log reader proxy. Apparently it was generated with square brackets as part of its name because when I select from sys.credentials, its entry's name is [REPL][BACP\jeremy][DAVEG1525-162-AssessmentSystemLiveTest-1].

How can I alter its credential? I tried this:

ALTER CREDENTIAL [REPL][BACP\jeremy][DAVEG1525-162-AssessmentSystemLiveTest-1] WITH IDENTITY = N'BACP\jeremy', SECRET = N'NewPasswordHere'

However it says that this is incorrect syntax. The MSDN page for ALTER CREDENTIAL only gives examples for credentials whose name doesn't contain square brackets. How can I alter this credential?

Jez
  • 27,951
  • 32
  • 136
  • 233

2 Answers2

1

This actually worked:

ALTER CREDENTIAL [[REPL]][BACP\jeremy]][DAVEG1525-162-AssessmentSystemLiveTest-1]]] WITH IDENTITY = N'BACP\jeremy', SECRET = N'NewPasswordHere'

Escaping square brackets in SQL Server is not nice. :-)

Jez
  • 27,951
  • 32
  • 136
  • 233
0

You can escape [] brackets as shown in this post:

How can I escape square brackets in a LIKE clause?

Hopefully that will point you in the right direction.

Community
  • 1
  • 1
connectedsoftware
  • 6,987
  • 3
  • 28
  • 43