Results 1 to 3 of 3
  1. #1
    Join Date
    May 2003
    Location
    California Coast
    Posts
    72

    Unanswered: how to find statistics for a column

    I am trying to code a tsql routine to check for the existence of statistics before a column is dropped. If the stats exist I want to drop the stats first and then drop the column. I Can do this manually but need it in a script.

    Mike

  2. #2
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Um....why?

    blindman

  3. #3
    Join Date
    May 2003
    Location
    California Coast
    Posts
    72
    First reason is that the column cannont be dropped while the statistic is pressent.
    Second, there are 15 db's that need to have the obsolete column(s) dropped.
    Third, all steps are documented.
    Fourth, gui's take 2 long. Just run a command.
    Fifth, There are dozens of obsoleted columns that are being dropped in the next release.


    mike

    eg.sample of the errors generated.
    Server: Msg 5074, Level 16, State 8, Line 9

    The statistics 'HHAltCouponName' is dependent on column 'HHAltCouponName'.

    Server: Msg 4922, Level 16, State 1, Line 9

    ALTER TABLE DROP COLUMN HHAltCouponName failed because one or more objects access this column.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •