

INNER JOIN sys.objects sp ON sd.referencing_id = sp.object_id INNER JOIN sys.sql_expression_dependencies sd ON o.object_id = sd.referenced_id For the database that has many tables, showing all tables at a time may not be intuitive. Order by cte.referencing_entity_name, CASE WHEN cte.referencing_entity_name IS NULL THEN 0 ELSE cl.column_id END As you can see, all the tables are the base tables except for the contacts table which is a view.

SELECT CTE.referencing_entity_name Object_name, CTE.referencing_object_type Type, CTE.referenced_entity_name, CTE.referenced_minor_name Column_name, CTE.type_desc referenced_entity_typeįROM CTE_Objects CTE LEFT JOIN sys.columns cl ONĬte.object_id = cl.object_id AND cte.referenced_minor_name = cl.name Columns: A list of all the columns in a selected table. Analytics User Deletion API v3, Delete all data in a Google Analytics property. Results table: After you successfully execute a SQL query, the results are. ON refObj.referenced_entity_name = obj.name Click the name of the API you want to explore in the list below. ''', ''OBJECT'') refObj INNER JOIN sys.objects obj Write a SQL statement to display a string 'This is SQL Exercise, Practice and Solution'. Click me to see the solution with pictorial presentation. SELECT ''' + + ''', (SELECT type_desc from sys.objects where name = ''' + + '''), referenced_entity_name, NULL, obj.type_descįROM sys.dm_sql_referenced_entities (''dbo.' + '' + + Write a SQL statement that displays all the information about all salespeople. INNER JOIN sys.dm_sql_referenced_entities(''dbo.' + + ''', ''OBJECT'') refobj ON INNER JOIN sys.objects obj ON sed.referenced_entity_name = obj.name This is all about the bulk insertion of the table using union all. INNER JOIN sys.objects o ON sed.referencing_id = o. One takes three records from Product table and the second one takes one record from the static select query, after executing all the above SQL Queries at a time you will see below output as I showed below. WHERE object_id = OBJECT_ID(N'.')ĬREATE PROCEDURE. Have a read here: How can i get the list of tables in the stored procedure WITH storedprocedures AS ( SELECT o.name AS procname, oo.name AS tablename, ROWNUMBER() OVER(partition by o.name,oo.name ORDER BY o.name,oo.name) AS row FROM sysdepends d INNER JOIN sysobjects o ON o.idd.id INNER JOIN sysobjects oo ON oo.idd.depid WHERE o.xtype 'P') SELECT procname, tablename FROM stored.
