ALTER CREDENTIAL [HCC SQL] WITH
How to skip space in a query
Hello,
I am trying to alter credentials using a SQL query "ALTER CREDENTIAL credential_name WITH IDENTITY = 'identity_name'
[ , SECRET = 'secret' ]"
And the issue is that my credential_name has a space in it. so that would make my query look something like:
ALTER CREDENTIAL HCC SQL WITH IDENTITY = 'username', SECRET = 'password';
Which gives me the following error:
Msg 102, Level 15, State 1, Line 4
Incorrect syntax near 'SQL'.
Msg 319, Level 15, State 1, Line 4
Incorrect syntax near the keyword 'with'. If this statement is a common table expression, an xmlnamespaces clause or a change tracking context clause, the previous statement must be terminated with a semicolon.
So I was wondering if there is a way to skip the space in this query?
Or would I have to change my credential_name to something with no spaces?
Thanks
SQL Server Other
2 additional answers
Sort by: Most helpful
-
Viorel 122.6K Reputation points
2021-02-26T20:41:41.8+00:00 Did you already try ALTER CREDENTIAL [HCC SQL] WITH...?
-
Cris Zhan-MSFT 6,661 Reputation points
2021-03-01T06:08:53.427+00:00 Hi,
The square brackets [ ] and double quotation marks (") are used to delimit identifiers. This is necessary if the object name(identifier) is a reserved keyword or contains special characters such as a space or hyphen.
https://stackoverflow.com/questions/9917196/meaning-of-square-brackets-in-ms-sql-table-designer