Try using the osql utility to run the scripts to create the tables, views, constraints and other objects.... you can check this link for reference on osql
http://technet.microsoft.com/en-us/library/aa213090.aspx
and for handling the use database name problem: you can try using fully qualified...