# Miscellaneous > SQL Scripts >  Hoping someone can help with scripting this...

## motty

Novice when it comes to SQL...

We have a number of databases we need to weekly shrink...yes, I know that more drive space would be the best thing, but that is not practical, at this time...

we do a query on each db as such..
DUMP TRAN (db) With NO_LOG (yes, I know...we back them up nightly)
dbcc updateuseage (db)

after doing this for each db, we then run a shrink on each one...

What I would like to do is to somehow script this activity, to run easily and not so tediously...

Can anyone help?
Thanks!

----------


## rmiao

Auto shrink option doesn't work?

----------


## motty

Again, a newbie...can you explain how to auto shrink?

----------


## yogeshsr11

When the AUTO_SHRINK option has been set to ON, the Database Engine automatically shrinks databases that have free space.
AUTO_SHRINK ON | OFF 
If ON is specified, the database files are candidates for automatic periodic shrinking.

----------


## rmiao

You can set that by right click the db in enterprise manager and go to properties -> options tab, check auto shrink.

----------

