Reputation: 2177
I used visual studio 2013 for developing a web application and used a localDB in development phase, now I want to go to production phase and want to export the sql server localDb to the online SQL server database, but I cannot find any option to script out the localDb or migrate it?
Which tools I can use to do this ? or what I must do?
Upvotes: 4
Views: 9034
Reputation: 978
There are atleast two routes; you could publish and recover as Data Tier Application:
Or, the easier-but-lengthier route would be to:
- Create a new DB in the SQL Server Management Studio (Naming it the same as LocalDB is helpful if you just want to change the connection string later)
- Right-click database on SQL Server Object Explorer and select
Schema Compare
- Click
Select Target
and navigate throughSelect Target Schema(Dialog) > Database > Click on Select Connection > Connect(Dialog) > Browse > Local > Database Name > Select the Databse you created in Step-1
. Then, click OK- Click
Compare
or, hitShift+Alt+C
- Then, the Schema Comparator tells you whats different between the two databases (the one from MSSqlLocalDB and the one you just created in Step-1). It is important to remember unchecking ANY entries for
delete
operations, if you are simply transferring data and schema. Keepadd
operations as it is.- Then, click on ↑
UPDATE
(the option is located right beside Compare)- Your Target database should be updated
Upvotes: 4
Reputation: 2177
Unfortunately VS2013 does not has any feature to script out a localDb, I waste so many time to copy table by table scripts, and run it at remote db. my local db id sql v11.0 (2012 I think). and the remote db was sql server 2008. so one way exist is to install an instance of sql server 2012 and sql server management studio to script out my db. maybe another tools also exist it is very sad that vs has not this feature.
Upvotes: 0
Reputation: 468
You can attach the localDb to SQLServer 2005 or higher and then you can generate scripts or export data to remote server. Or If LocalDb is SQL Server 2012, use SSMS 2012 or later for this scripting task.
Upvotes: 2