Find all tables whose name ends with a specific suffix

I have a thousand tables in the database. Some names end in _History .

For example:

 abc_History bcd_History 123_History 

How to find all tables whose names end in _History .

Some things like:

 SELECT table_name FROM sys.tables WHERE table_name LIKE '_History%' 

AND

 error : Invalid column name 'table_name'. 
+7
sql sql-server select sql-server-2008 information-schema
source share
1 answer

Try the following:

 SELECT TABLE_NAME FROM INFORMATION_SCHEMA.tables WHERE TABLE_NAME LIKE '%_History' 

OR

 SELECT name FROM sys.tables WHERE name LIKE '%_History' 
+11
source share

All Articles