I am using SQL Server 2014 and want to get all the tables name in a particular database STUDENT
through a SQL query.
How is it possible?
Thanks
I am using SQL Server 2014 and want to get all the tables name in a particular database STUDENT
through a SQL query.
How is it possible?
Thanks
You want to query sys.objects and look for everything with the type description 'USER_TABLE'. You could use a query like this;
SELECT
*
FROM STUDENT.sys.objects
WHERE type_desc = 'USER_TABLE'
The FROM clause has the usual format: DatabaseName.SchemaName.TableName.
Or as marc_s mentions, you can use sys.tables instead;
SELECT
*
FROM STUDENT.sys.tables