These scripts can be used to attach detach the database. the batch files are ready to use as is. copy these files to a folder c:\scripts and execute from there. or you can use osql interactively and type the commands.