Search code examples
asp.netsql-serveraspnetdb

Exporting ASPNETDB.MDF to an external database


ASP.Net 4.0/C#/MSSQL/Microsoft SQL Server Management Studio

Hey I am now at the stage where I want to move a project to a live server

Now I want to move the tables from the ASPNETDB file in the App_Data folder to the server.

I have used the Aspnet_regsql.exe tool to successfully generate the following tables on my shared hosted server

dbo.aspnet_Applications dbo.aspnet_Membership dbo.aspnet_Paths dbo.aspnet_PersonalizationAllUsers dbo.aspnet_PersonalizationPerUser dbo.aspnet_Profile dbo.aspnet_Roles dbo.aspnet_SchemaVersions dbo.aspnet_Users dbo.aspnet_UsersInRoles dbo.aspnet_WebEvent_Events

Now what is the next step to essentially copy the tables from ASPNETDB.MDF to these tables on the server?

Many thanks =)


Solution

  • What version of SQL server have you got?

    If you can open the database locally in SQL Management Studio you can just use Generate Scripts that you can then simply open and run on your production server. It has the option to copy

    • Data
    • Schema
    • Both

    So you can start with an empty database on Production and copy both the data and schema at once with a single .sql file and you'll be good to go.