Anonymous
Asked in
Cars &Transportation
·
2 weeks ago
How can I see which table is used in SQL Server?
Contents
- How do you check if a table is being used in SQL Server?
- How do I find the referenced tables in SQL Server?
- How do I get a list of tables used in a stored procedure in SQL Server?
How do you check if a table is being used in SQL Server?
Look in sys. dm_db_index_usage_stats. The columns last_user_xxx will contain the last time the table was accessed from user requests. This table resets its tracking after a server restart, so you must leave it running for a while before relying on its data.
How do I find the referenced tables in SQL Server?
To view the objects on which a table depends1In Object Explorer, expand Databases, expand a database, and then expand Tables.2Right-click a table, and then click View Dependencies.
How do I get a list of tables used in a stored procedure in SQL Server?
Using below mentioned important T-SQL query, we can get the list of the tables used in the stored procedure.1SELECT.2NAME as 'List Of Tables'3FROM SYSOBJECTS.4WHERE ID IN ( SELECT SD.DEPID.5FROM SYSOBJECTS SO,6SYSDEPENDS SD.7WHERE SO. NAME = 'Sp_ListTables' ----name of stored procedures.8AND SD.ID = SO.ID.
Related Questions
Relevance
-
Anonymous2 weeks ago
Expert answer2 weeks ago -
Anonymous2 weeks ago
Expert answer2 weeks ago -
Anonymous2 weeks ago
Expert answer2 weeks ago -
Anonymous2 weeks ago
Expert answer2 weeks ago -
Anonymous2 weeks ago
Expert answer2 weeks ago -
Anonymous2 weeks ago
Expert answer2 weeks ago -
Anonymous2 weeks ago
Expert answer2 weeks ago
Write us your question, the answer will be received in 24 hours