I would like to do a lookup of tables in my SQL Server 2005 Express database based on table name. In MySQL
I would use SHOW TABLES LIKE "Datasheet%"
, but in T-SQL
this throws an error (it tries to look for a SHOW
stored procedure and fails).
Is this possible, and if so, how?
Try this:
And, since INFORMATION_SCHEMA is part of the SQL-92 standard, a good many databases support it - including MySQL.
This will give you a list of the tables in the current database:
Some other useful T-SQL bits can be found here: http://www.devx.com/tips/Tip/28529
Try it :
MS
is slowly phasing out methods other thaninformation_schema
views. so for forward compatibility always use those.I know you've already accepted an answer, but why not just use the much simpler sp_tables?