Generating a UPDATE STATS for specific tables only

  • I am attempting to generate an update stats for all tables with scheduleday in it and having problems.... the with sample makes the query fail and the a, has to be there to get the query to be syntax correct but it doesn't do anything..... Any help would be appreciated.

    SELECT 'UPDATE STATISTICS dbo.' a,table_name 'WITH SAMPLE 50 PERCENT'

    FROM INFORMATION_SCHEMA.TABLES

    where table_name like '%ScheduleDay%'

  • try this

    SELECT 'UPDATE STATISTICS dbo.'+ table_name +' WITH SAMPLE 50 PERCENT'

    FROM INFORMATION_SCHEMA.TABLES

    where table_name like '%ScheduleDay%'

  • Thats it ! Thanks... I knew I was missing something. (Brain Cramp) It is one of those trying this and that and just needed someone else to look at it.

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

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