"SELECT TRIGGER"

  • I know it doesn't exist, but that best describes what I need -

    Basically I have a table that many sp's and ad hoc queries reference. However there are entities in the table that need to be cleaned out, and I need a way to figure out which ones get referenced by a where clause (i.e where rid = 382).

    Anyone have any suggestions? Running a trace is not an option, because I need to collect data for at least a month.

  • You just need to filter the trace correctly. Once you do that, the trace will produce no more data than a TRIGGER ON SELECT would.

    [font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
    Proactive Performance Solutions, Inc.
    [/font]
    [font="Verdana"] "Performance is our middle name."[/font]

  • You also can play with it (I would)

    by making a copy of that table and than removing all the junk you suspect is redundant.

    After that you'll see in the error messages from SP's and ad-hoc quaries wich are being referenced and bring them back.

  • I agree with Barry. Just create a trace, to only select the textdata of statements (SP and T-SQL). Filter this on the databasename and "%TabelName% %ColumnName%" and you only get the statements that actually access the specified table with the columname included.

    Keep in mind that it also won't log a statement like "SELECT * FROM TableName WHERE ColumnName2 = 123".

    ** Don't mistake the ‘stupidity of the crowd’ for the ‘wisdom of the group’! **

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply