Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Search in Database

Author  Topic 

aakcse
Aged Yak Warrior

570 Posts

Posted - 2009-08-25 : 09:51:46
Hi all
How can I search a particular text in entire database user.

say suppose I want to see which sp is inserting data into
table1.

say some thing like if I want to search "insert into table1"

Regards,
CSE

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2009-08-25 : 10:02:26
Script all objects from the database level (Right Click -> Tasks -> Generate Scripts...), then search the produced file.
Go to Top of Page

Nageswar9
Aged Yak Warrior

600 Posts

Posted - 2009-08-25 : 10:09:13
Hi, Try this once

select object_name(id) from sys.syscomments where text like '%insert into table1%'
Go to Top of Page

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2009-08-25 : 10:10:31
select object_name(id) from syscomments where text like '%insert into table1%'
Go to Top of Page

lionofdezert
Aged Yak Warrior

885 Posts

Posted - 2009-08-25 : 10:21:47
http://connectsql.blogspot.com/2009/08/find-text-used-in-store-procedure.html
Go to Top of Page

aakcse
Aged Yak Warrior

570 Posts

Posted - 2009-08-26 : 06:50:08
Thanks all of you for the comments, each and every reply is helpful Thanks again.

Also please let me know how can I mark this thread as answered
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-08-26 : 07:01:22
quote:
Originally posted by aakcse

Thanks all of you for the comments, each and every reply is helpful Thanks again.

Also please let me know how can I mark this thread as answered


The only way I know is to edit the topic by appending (Solved)

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

DonAtWork
Master Smack Fu Yak Hacker

2167 Posts

Posted - 2009-08-26 : 07:29:52
Also
SELECT ROUTINE_NAME FROM Information_shcema.ROUTINES WHERE routine_definition like '%insert into table1%'

OR, just search for the table name, then look at each SP and see what it is doing to that table in case there is no SPECIFIC insert into ....

http://weblogs.sqlteam.com/jeffs/archive/2008/05/13/question-needed-not-answer.aspx
How to ask: http://weblogs.sqlteam.com/brettk/archive/2005/05/25.aspx

For ultra basic questions, follow these links.
http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp
Go to Top of Page

rohitkumar
Constraint Violating Yak Guru

472 Posts

Posted - 2009-08-26 : 09:31:31
here's one more...

SELECT * FROM sys.sql_modules where definition like '%insert into table1%'
Go to Top of Page
   

- Advertisement -