Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploying ASP.Net MVC application

I've recently reached the stage where an ASP.net MVC application I am developing is ready to be deployed to the production server. I've worked out how to publish the application - I've got all the files on the server, and can access them over the internet.

However, I can't work out how to deploy my database. The server has the SQL Server Management Studio Express installed, as the database used is a SQL Server Express database. I have the server instance up and running - I just don't know how to add the tables, etc. to the database.

I have created the "CREATE TABLE" scripts on the development machine, but as far as I can see, Management Studio does not provide any way to actually run these scripts. I have looked through all the menu items that I could see, and none of them worked. Even using the "Create new query..." option and pasting the script in didn't work.

When I try "File->Open..." and select a script to run, set the correct database from the dropdown list on the toolbar, and then execute the script, it complains about not finding the database file (even when I set the USE [...] statement to the correct path.

Deleting the USE [...] statement, the script complains that it can't find the [dbo].[Invoices] object; however, it shouldn't be able to find it, because its trying to create it!

tl;dr: What's the best way to make sure that the database on the production machine matches the database on my development machine?

EDIT: One of the scripts is online here. The output (after the first two lines were deleted) is here.

like image 713
a_m0d Avatar asked Feb 16 '26 07:02

a_m0d


1 Answers

The DATE data type was added in SQL Server 2008. Presumably, your production server is only running SQL Server 2005 and this is why you get the "Column, parameter, or variable #2: Cannot find data type date." error.

You'll have to change your data type to DATETIME (which is supported on SQL Server 2005).

like image 145
Dean Harding Avatar answered Feb 17 '26 21:02

Dean Harding



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!