Skip to content

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

@shannonlowder

Description

@shannonlowder

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions