0

Im using c# .net windows form application. i have a SQL database with 5 tables. i need to populate a combobox with these table names. only names should be displayed.

saeed
  • 673
  • 3
  • 12
  • 22

2 Answers2

1

Can't know for sure until you specify what you're using, but this is a more or less standard query for retrieving the table names (excluding views) in the current database:

SELECT TABLE_NAME
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_TYPE = 'BASE TABLE'
Matti Virkkunen
  • 63,558
  • 9
  • 127
  • 159
1

From MSDN.

SELECT name FROM sys.tables;

Works for SQL Server 2005 and above.

anonymous
  • 3,474
  • 25
  • 29