Importing data into new database configuration - asp.net

I had a website, with an sql server database. I decided to create a new version of the site, so I downloaded the database + website onto my local dev PC, and added a whole bunch of stuff to both - in particular, I added lots of new stored procedures, columns and tables to the database, while leaving the existing data for the site in place while doing this.
It is now time to launch the new version. Of course, while working on the new version, the data in the database on the live site has changed - new users have signed up and so on, so I can't just push the dev enviroment database live, as this would lose data.
What is the best way to import all the data from the existing database into the new database configuration? Should I take the existing database, and then add all the columns, procs, tables, indexes and so on in to it, or is there a better way?

You can use SQL Compare or other comparison tools to make the production database look like your dev database. If budget is a concern you can see plenty of alternatives in this blog post.

In SQL Server Management Studio , right click on your local database -> Task -> Generate Scripts, and then you'll be able to select your SP/Functions and then execute these script against the production database

Related

How to update sqlite db file after deployment the app in windows phone store

I have deployed the 1st version of my wp8 in wp store and now i want to deploy the update version of it. Though I know the process of update deployment, but my concern is the sqlite file which doesn't get updated.
Here is the scenario, I have sqlite file in the app where user can store config and setting, in new version I added extra tables and I want to these tables should be reflected in the the update without affecting user settings and config.
What points I should consider to take care of this issue?
Thanks!
Assuming the data in the sqlite database is static you can give the database a new name and submit it with the updated app. One first run copy the new database to isolated storage and delete the old version of the database to save space.
If the user is inputting data into the database you will have to include code to modify the database structure on the first run and insert any records into the new table

Move a remote development database to local usage

I have been using a central MS SQL database located in the cloud to develop a web site project. I have recently found myself in situations, when I need to develop without the internet connection. I want to begin to use a locally available copy of the existing database, put it in App_Data folder.
What is the correct set of steps I need to undertake to get the project to work with local DB?
For example:
Detach a db from an existing SQL instance.
Copy to a development machine.
etc.
Moving a SQL-Server DB is not that hard. Look here for some methods to do it.
http://support.microsoft.com/kb/314546
I usually find the sp_detach + sp_attach method really easy.
I would create an empty shell database locally, then use one of the many schema comparison solutions available to make the local database look exactly like the cloud database.
Correct way is to create and regularly update your standalone copy of database using import/export. In particular MS SQL Server provides Import/Export Wizard tool for such purpose.
Make a backup
Copy backup file
Restore on your server
Restore/organise users

Sql Server data -> MySql + Django migration

I have an existing website built on ASP.NET + SQL SERVER. It should move to Django + mysql soon.
What is the best practice to create the new MySql DB? I would like to keep some Unique IDS because they affect the URLS that should remain the same after the transfer.
Also I want to avoid the option to inspect database with Django because many models will be changed somehow.
If this was my site I will follow this steps:
Create the new CDM (Conceptual Data Model) of the new database
Create django models that will catch with new CDM.
With SSIS, migrate SQL Server Database to MySQL. (Relax some restrictions and constraints if it is needed)
Add relaxed restrictions and constraints to new database (auto_increment columns).
Enjoy

Is there anyway to "add" tables to existing database when using Code First?

I want to add a module build on Code First to a running website, which already has an database. If I set my module to run on separated database, it works fine.
But my friend want to just "add" tables created by my modules to existing database, without adding a new database.
Is there anyway to archive that?
The solution is simple and very easy:
Run the module to create a new, clean database
Use SQL Server to generate sql scripts that create tables of that database. I personally think the metadata table is not needed
Run those scripts against target database
Modify the connection string to point to target database
Now it runs flawless! I'm so happy
Thank you.

ASP/ASP.net: Web-based JET database management tool?

I need to manipulate some tables in a JET database housed on a web-server:
check existing indexes
change table cluster/primary key
see what tables exist
rename tables
add tables
drop tables
browse data
etc
I don't have the option of installing PlaneDisaster or Access (even if i had it) on the local machine.
I've already written a generic web-based query tool. I'd rather not have to get into writing a whole web-based database maintenance GUI. Someone must have done this already, and probably many times over.
A partial answer might be Compare'Em
http://home.gci.net/~mike-noel/CompareEM-LITE/CompareEMscreens/CompareEM-About.htm The Pro version allows you to create SQL statements to update the Access database file. This will allow you to generate the differences between one version and a newer version.
His website isn't very clear but as I recall the price for the Pro version was $10.
As you say you have already done a generic web based query tool. The problem with JET is that you cannot connect with it as database server like you can do with one SQL server in order to process changes to tables and other maintenance procedures. Jet is is not a client/server RDBMS. You need to have an application in the server to do that for you as you already have done with your generic web based tool, or download the database to your machine. That's why you have done some procedures and locate them in the server as asp pages.
Anyway you can use JetSQLConsole, if you don't want to use Planedisaster or Access, but remember that you need always an application on the server to to the job for you
You can also use access "in your machine" and connect to a database located in a URL (http://myserver/mydatabase.mdb) but remember when you are doing this you are downloading all the database and when you save it you are uploading it again.

Resources