Which SQL Storeproc or other object Use a Column

you have hundreds of existing storeprocs, view, udf, and you decided one day to change or remove column name.

How do you know which one still using old column? it won’t let you know unless you execute it.

you need to trace sql server store proc text and find it?

here is the answer

   1: SELECT DISTINCT so.name
   2: FROM syscomments sc
   3: INNER JOIN sysobjects so ON sc.id=so.id
   4: WHERE sc.TEXT LIKE '%SCI_AccessoryPack%'
   5: or
   6: sc.TEXT LIKE '%LCT_AccessoryID%'
   7: or
   8: sc.TEXT LIKE '%LEN_PrismAccessoryID%'
Share this post: | | | |
Published Friday, July 6, 2012 4:19 PM by cipto

Comments

No Comments