Click here to Skip to main content
15,880,469 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Need to find the source and conditions through which a particular table populates on server.

What I have tried:

1. I have checked the dependencies on that table.
2. Checked if there is any SP which populates it.
3. No trigger available which does this.
4. No, SSIS package available.
Posted
Updated 23-Jan-18 21:12pm
Comments
GKP1992 24-Jan-18 3:22am    
Did you try using the profiler?

Here are a few queries to see where/what is connecting to your box and then you should begin to narrow down where the table is being populated from.

Listing of connections

SQL
SELECT * FROM     sys.dm_exec_connections


Query that lists detailed info among that being the last executed sql query - from sql server - how to get History of queries executed with username in SQL - Database Administrators Stack Exchange[^]

Lists IP address and last ran queries.
SQL
SELECT sdest.DatabaseName 
    ,sdes.session_id
    ,sdes.[host_name]
    ,sdes.[program_name]
    ,sdes.client_interface_name
    ,sdes.login_name
    ,sdes.login_time
    ,sdes.nt_domain
    ,sdes.nt_user_name
    ,sdec.client_net_address
    ,sdec.local_net_address
    ,sdest.ObjName
    ,sdest.Query
FROM sys.dm_exec_sessions AS sdes
INNER JOIN sys.dm_exec_connections AS sdec ON sdec.session_id = sdes.session_id
CROSS APPLY (
    SELECT db_name(dbid) AS DatabaseName
        ,object_id(objectid) AS ObjName
        ,ISNULL((
                SELECT TEXT AS [processing-instruction(definition)]
                FROM sys.dm_exec_sql_text(sdec.most_recent_sql_handle)
                FOR XML PATH('')
                    ,TYPE
                ), '') AS Query

    FROM sys.dm_exec_sql_text(sdec.most_recent_sql_handle)
    ) sdest
ORDER BY sdec.session_id
 
Share this answer
 
Do not have permission to perform "
sys.dm_exec_connections"
 
Share this answer
 
Comments
CHill60 24-Jan-18 5:25am    
If you want to comment on a post then use the "Have a Question or Comment?" link next to it. @David_Wimbley will have no notification that you have responded.
You need to sort out your own permissions, or get someone with the appropriate permissions to run the query for you

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900