If you do a SELECT * FROM information_schema.tables you'll see that there's a column there called TABLE_SCHEMA. That's where you'll find your dbo. I'm assuming you are wanting to handle other schemas that aren't dbo.

Just modify the script so that you can pass TABLE_SCHEMA + TABLE_NAME.

Thanks for the prompt reply. I am new with the coding, this is what I have but I am hitting a road block.USE pubsGOSET NOCOUNT ONGODECLARE updatestats CURSOR FORSELECT table_schema, table_name FROM information_schema.tables where TABLE_TYPE = 'BASE TABLE'OPEN updatestats

I also prefer cursor variables in scripts because they go away by themselves - if the script halts without explicitly deallocating, you don't have to fuss to get it to run again. Also table variables. But my example here, a temporary table declared inside dynamic SQL which runs as a separate batch, is a lazy way to get the same benefit - table goes away when execution halts for any reason.

It also isn't an example to do with statistics, just a demonstration that objects can be given stupid names. This can happen if you have perversely motivated co-workers. The guy who mounts our server hardware likes to demonstrate his multilingual and multidisciplinary skill (exotic minerals? mythological characters in light opera? minor bodies of the outer solar system? some of which categories overlap, but thank god we closed our office in India), and our major databases, hundreds per server, all begin with a digit 0-9. We wear out more [ ] keys...

Thanks also for the hint about the IFCode Shortcuts on the left side of the editing pane. Had not noticed those but wondered how to people displayed the code nicely. I will make use of those in my future posts.