I need to find an insert statement into a specific table. Unfortunately, the application isn't mine to begin with, there are over 100 stored procedures in the database, I've stepped through the code writing down every stored procedure name from begining to end of this process and I still cannot find it. I know that the process has to occur some where because another process that depends on it works properly. I just cant find it.
Is there some sort TSQL that would allow me to search across multiple stored procedures for a specific line of text... more specifically "INSERT INTO [tablename]"
UPDATE
I've tried using:
SELECT routine_name, routine_type
FROM INFORMATION_SCHEMA.ROUTINES
WHERE ROUTINE_DEFINITION LIKE '%INSERT INTO [tablename]%'
Straight out, replacing [tablename] with the name of my table. This returns 0 rows.
I DO have a procedure with that exact line in it, and I would have assumed that it would have been returned in the above query, but its not bringing back anything at all.
UPDATE #2
After using the redgate sql search tool (using INSERT INTO [tablename]) it returns 1 sp, but i'm still in denial that this is correct due to some of the tsql (at the end of the sp its dropping tables that are still in the database...) (this is where my in-experience at sql shines through)
I still cant find where this is being called from though...
UPDATE #3
I just did a search on the entire solution for 'INSERT INTO [tablename]' to see if they maybe DIDN'T use a stored procedure for this call, and nothing... didn't find it anywhere.