Thursday, February 3, 2022

Wana Query all tables in SQL DB

 Hey Sqeeps,

I was running an upgrade today and had to jump a major version while upgrade (from 2008R2 to 2019). I know not yet on 2022. It takes time for old joints to move. :) 

Well there was a small hiccup that there were a lot of tables in the db and I need to run some sanity check before I could hand over the database to the development team. 

So thought of putting together a small cursor which should help anyone with read permissions to run a sanity check on all tables in the databases. 



Well that runs like a monster and takes for ever so modified the query to take just 1000 rows from each table. 


Hope this helps SQeeps. 


Untill Next time,

Cheers,

Tushar