IfDo you have a set of SQL scripts that you run all the time? Have you thought about creating a batch file to call these scripts whenever you need them to run? Here is how you would do such a thing.

First, create a folder on your computer and call it something such as scripts and then drop your scripts into the folder (Figure A).

Figure A.

Next, create a batch file that points to the script or scripts that you created (Figure B).

Figure B.

Your script or scripts can be as easy or as complex as you want. Create a set of scripts to help you in your daily life.

Let’s now go ahead and run our batch file (Figure C).

Figure C.

Another script I tend to run a lot is a reset permissions script. Figure D. shows the output.

Note: You can run a sqlcmd /? to get a listing of all your switches (Figure E).

Figure E.

Go ahead and experiment and see what you can come up with. Good Luck!