5 min read Sep 26, 2026

How to Import and Export an MS SQL Database on Windows Hosting

Move an MS SQL database to or from Windows Hosting with SSMS: generate scripts, export a .bacpac, run large scripts with sqlcmd and copy data with the wizard.

FimuroHost Team

FimuroHost Team

Technical Writer

Share Article

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

MethodBest for
Generate ScriptsMoving 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 WizardCopying 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

  1. In SSMS, connect to the source server (e.g. your local SQL Server or LocalDB).
  2. Right-click the database and choose Tasks → Generate Scripts…
  3. 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.
  4. On Set Scripting Options, choose Save as script file and Single script file, then click Advanced.
  5. Set these options:
OptionValueWhy
Types of data to scriptSchema and dataIncludes the rows, not just empty tables
Script USE DATABASEFalseYour hosted database has a different name
Script for Server VersionThe version of the target serverAvoids syntax the target doesn't understand
Script LoginsFalseLogins are managed by the hosting
Script Indexes / TriggersTrueKeeps performance and logic
  1. Finish the wizard and save the .sql file.

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"
  • -C trusts the server certificate (needed by recent sqlcmd versions, which encrypt by default).
  • -o writes 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 65001 so 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.

  1. Connect SSMS to mssql.stackcp.com.
  2. Right-click your database and choose Tasks → Export Data-tier Application…
  3. Choose Save to local disk and pick a file name, e.g. shopdb-2026-09-26.bacpac.
  4. 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:

  1. Open SQL Server Import and Export Data from the Start menu (it is installed with SQL Server; use the 64-bit version).
  2. Data source: Microsoft OLE DB Driver for SQL Server (or SQL Server Native Client), pointing at your source database.
  3. Destination: the same driver, server mssql.stackcp.com, SQL Server authentication and your hosted database.
  4. 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.
  5. 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 DATABASE or USE [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 varchar instead of nvarchar, or the file was read with the wrong encoding. Use nvarchar columns and N'…' 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.

FimuroHost Team

Written by

FimuroHost Team

Technical Writer