To be able to do the above you will need to install SQL Server Management Studio Express or SQL Server Management Studio (the not so free version), SSMS. The following describes the steps necessary to execute a script called createDatabaseAndTablesTest.sql:
- Connect to the SQL Express Server from SSMS. Usually the SQL Express Server is located at <COMPUTERNAME>/Express.
- Attach the *.mdf file, the SQL Server Express database, that you wish to execute the script on. You may need to detach this database first if you have it attached via Visual Studio or somewhere else.
- Execute the sql script once you've selected the appropriate database, ie. the attached database above. If this database does not appear in the selections, which happened in my case, right-click on the database and choose "New Query". And then just copy and paste the content of your script into this new query and execute it.