This small query gives you the tables, views and columns having characters likely not translating directly to ORM identifiers because they contain other characters than a-zA-Z0-9
:
select * from INFORMATION_SCHEMA.COLUMNS c where 1=0 or c.TABLE_NAME LIKE '%[^a-zA-Z0-9_]%' or c.COLUMN_NAME LIKE '%[^a-zA-Z0-9_]%'
The view [WayBack] COLUMNS (Transact-SQL) | Microsoft Docs in the … has been around since at least SQL Server 2000, so this is a pretty safe method for finding those columns.
As a bonus, I learned that SQL Server supports a subset of regular expression matches in like also since at least SQL Server 2000: LIKE.
Via [WayBack] SQL Server 2008 query to find rows containing non-alphanumeric characters in a column – Stack Overflow.
Related:
- [WayBack] SQL Server 2005: Protect your Metadata
- [WayBack] System Information Schema Views (Transact-SQL) | Microsoft Docs
–jeroen