Skip to content Skip to sidebar Skip to footer

How Can I Retrieve A List Of All Table Names From A Sql Server Ce Database?

Is there some SQL that will either return a list of table names or (to cut to the chase) that would return a boolean as to whether a tablename with a certain pattern exists? Specif

Solution 1:

This should get you there:

SELECT*FROM INFORMATION_SCHEMA.TABLES
 where table_name LIKE'%INV%'

EDIT: fixed table_name

Solution 2:

To check for exists:

--

-- note that the sql compiler knows that it just needs to check for existence, so this is a case where "select *" is just fine

if exists (select * from [sys].[tables] where upper([name]) like N'INV%') select N'do something appropriate because there is a table based on this pattern';

Solution 3:

You can try the following:

SELECT name FROM sys.tables where name LIKE'INV%';

Post a Comment for "How Can I Retrieve A List Of All Table Names From A Sql Server Ce Database?"