Closed seanmcne closed 3 years ago
Feel free to take a look - here's the update I used in our test environment and it worked well. It looks like the proper escape sequence is to double up the closing bracket to escape it out
Before: EPK[dbo].[testprofile2_systemuser] After: [EPK[dbo]].[testprofile2_systemuser]]]
https://github.com/yochananrachamim/AzureSQL/compare/master...seanmcne:master
Wouldn't you rename the broken index names once and then the database would be fixed up and no longer an issue?
if this can happen to index name, it might be the case with statistics name, table or schema name as well. I'm not sure if we should make the change to this global script or maybe it will be better for you to change the code in your environment as this is extremely edge case, any other thoughts about it?
I was able to fix it very easily, please download the latest version that contain the fix to enjoy this and more cool features.
I am working in a DB where some system generated index names (below) are causing syntax issues. I realize the syntax is totally incorrect, but since this is coming from a product system generating the indexes, I think the script here can probably be changed to accommodate odd naming
The constraint name I'm running up against is named 'EPK[dbo].[testprofile2_role]' (you can't make this up, I suspect it was initially a bug on creating the default constraints).
I'm thinking to escape it correctly the query to get the index names can be altered slightly to add a "replace(idxs.name, ']',']]')" - such as: