This script is essentially a generator which outputs a script in the query window which will grow all the datafiles ( or shrink them ) to the same amount as specified. This saves time having to write out long queries for multiple databases with multiple datafiles. The main purpose behind this script is if the user works on a system where the datafiles has to be the same size to ensure consistency, this script will help them out.
If the user enters an amount ( maybe by accident or on purpose ) which is less than what the current size of the primary MDF datafile ( which to my knowlege is usually the biggest ), an added security feature is in place warning the user that a shrink will occur, though if this is what you want, you have to provide a special parameter ( @vcYES which is outputted in the query ) to acknowlege that you are sure you want to continue ( think of it as SQL's way of clicking YES or no like in Windows ).
1)To use this script, paste it in a query window and connect to the database you want to work on.
2)Enter the current database name you are on in the @vcDatabaseName variable
3)Indicate to how many MB you want to grow\shrink the datafile in the @vcGrowAmountMB variable
4)Run the script and copy the result outputted into a new query window. This will be the script which does the work for you.
5)Do something else because now you have alot of free time :)