Moving a SQL Server database onto shared hosting works differently from your own server. You can't upload a .bak backup file and restore it yourself, because the database server can't see files on your computer, and your hosting login can't create new databases from SSMS. Instead you move the contents of the database: its schema (tables, views, procedures) and its data.
This guide shows the reliable methods, using the free SQL Server Management Studio (SSMS) and command-line tools from Microsoft. For connecting SSMS to your hosting database, see Microsoft SQL Server (MS SQL): What It Is and How to Manage It.
Before you start
- Create the (empty) target database in StackCP first; see Create an MS SQL Database and Connection Strings.
- Install the latest SSMS on a Windows PC.
- Check the size of your database. Hosted MS SQL databases are currently limited to 1 GB each; ask support before moving anything larger.
- Check the target server version with
SELECT @@VERSION;so you can script for a compatible version.
Choosing a method
| Method | Best for |
|---|---|
| Generate Scripts | Moving a database onto hosting. Works for most small and medium databases. |
| Export Data-tier Application (.bacpac) | Taking a complete backup off the hosting to your PC. |
| SQL Server Import and Export Wizard | Copying table data only, when the tables already exist. |
Method 1: Move a database onto hosting with Generate Scripts
Create the script from your source database
- In SSMS, connect to the source server (e.g. your local SQL Server or LocalDB).
- Right-click the database and choose Tasks → Generate Scripts…
- Choose Script entire database and all database objects. Untick Users and Database Roles if they appear; your hosting user already has the permissions it needs.
- On Set Scripting Options, choose Save as script file and Single script file, then click Advanced.
- Set these options:
| Option | Value | Why |
|---|---|---|
| Types of data to script | Schema and data | Includes the rows, not just empty tables |
| Script USE DATABASE | False | Your hosted database has a different name |
| Script for Server Version | The version of the target server | Avoids syntax the target doesn't understand |
| Script Logins | False | Logins are managed by the hosting |
| Script Indexes / Triggers | True | Keeps performance and logic |
- Finish the wizard and save the
.sqlfile.
Run the script on the hosting database
Small scripts (up to a few tens of MB): connect SSMS to mssql.stackcp.com, select your hosted database in the drop-down on the toolbar, open the .sql file and press Execute. Double-check the database drop-down before you run it.
Large scripts: SSMS struggles to open very big files, so use sqlcmd from a Command Prompt instead:
sqlcmd -S mssql.stackcp.com -d shopdb-3a1f -U shopdb-3a1f -P "YourPassword" -C -i "C:\backup\shopdb.sql" -o "C:\backup\import-log.txt"
-Ctrusts the server certificate (needed by recent sqlcmd versions, which encrypt by default).-owrites messages to a log file so you can check for errors afterwards.- If the file was saved as UTF-8 and contains non-English text (for example Bangla), add
-f 65001so characters are read correctly.
sqlcmd is included with SQL Server tools; if you don't have it, install the current sqlcmd utility from Microsoft.
Method 2: Back up the hosted database to a .bacpac file
A .bacpac contains the schema and all the data in one compressed file, and SSMS saves it on your computer, which makes it ideal for taking regular copies.
- Connect SSMS to
mssql.stackcp.com. - Right-click your database and choose Tasks → Export Data-tier Application…
- Choose Save to local disk and pick a file name, e.g.
shopdb-2026-09-26.bacpac. - Click Next, then Finish, and wait for every step to show Success.
To restore it later, you can import it into a local SQL Server (Databases → Import Data-tier Application), then use Method 1 to push it back to hosting. Import creates a new database, which is why it normally can't be run straight against the shared server. If you need a .bacpac or .bak restored directly onto your hosting database, open a ticket and ask whether we can do it for you.
Export can fail with validation errors if the database references other databases or uses features that .bacpac doesn't support. In that case, back up with Generate Scripts instead.
Method 3: Copy only the data with the Import and Export Wizard
If the tables already exist on the hosting database (for example because Entity Framework migrations created them), you can copy just the rows:
- Open SQL Server Import and Export Data from the Start menu (it is installed with SQL Server; use the 64-bit version).
- Data source: Microsoft OLE DB Driver for SQL Server (or SQL Server Native Client), pointing at your source database.
- Destination: the same driver, server
mssql.stackcp.com, SQL Server authentication and your hosted database. - Choose Copy data from one or more tables or views, tick the tables, and under Edit Mappings tick Enable identity insert so ID values are kept.
- Run the package and check that every table shows success.
Load parent tables before child tables, or temporarily disable foreign key checks, otherwise rows can fail on foreign key constraints.
Common problems
- “CREATE DATABASE permission denied”. The script contains
CREATE DATABASEorUSE [olddb]. Regenerate it with Script USE DATABASE = False, or delete those lines at the top. - “Cannot find the user” or errors on
CREATE USER. Remove user and role statements from the script. - Incorrect syntax near … The script was generated for a newer SQL Server version than the target. Regenerate with the right Script for Server Version.
- Bangla or other text becomes ???. The column type is
varcharinstead ofnvarchar, or the file was read with the wrong encoding. Usenvarcharcolumns andN'…'string literals.
Need help?
If something doesn't work as described, open a support ticket from your client area or message us on WhatsApp at 01818160926. Tell us the database name, the method you used and the first error message in the log.
Categories
Written by
FimuroHost Team
Technical Writer