Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SQLCop].[test Table name problems] -- logic check #19

Open
shannonlowder opened this issue Jan 21, 2022 · 0 comments
Open

[SQLCop].[test Table name problems] -- logic check #19

shannonlowder opened this issue Jan 21, 2022 · 0 comments

Comments

@shannonlowder
Copy link

Currently, the logic check for invalid table names is:

SET @AcceptableSymbols = '_$' TABLE_NAME COLLATE SQL_LATIN1_GENERAL_CP1_CI_AI Like '%[^a-z' + @AcceptableSymbols + ']%'

The way I read that is if the table name has any character, anywhere in the table name that isn't an underscore, dollar sign, or the letters a through z, fail. A few problems in that logic:

Tables that start with underscore or dollar sign would require brackets.
Tables can have numerics in the name (just not for the first character)
Tables could have a space if they are bracketed.

Should this test assume brackets are in use when needed? Should this test actually attempt to create a table with the given name to test it's valiidty like this solution on StackOverflow?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant