I was thinking about how to use osql ( the command line utility of SqlServer) to install a DB with initial values (from an existing DB) and do it without opening the SQlServer Management Studio (bcoz quite often wee need to provide a packaged intalltion along with data) . I found out that it was a prettty nice idea to attach the data files of the DB(.ldf and .mdf) and create the new DB...
The foll. does that for you..
set useDatabase="USE MASTER"
set createdbstmt="CREATE DATABASE %4 ON PRIMARY(NAME=N'%4',FILENAME=N'%6',MAXSIZE=UNLIMITED) LOG ON (NAME=N'%logfilename%',FILENAME=N'%5',MAXSIZE=UNLIMITED) FOR ATTACH"
osql -S %1 -U %2 -P %3 -Q %useDatabase%;%createdbstmt%
REM %4=New Database Name,, %6=.mdf file path,, %logfilename= %4 + _log , ,