Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6605605
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:18:12+00:00 2026-05-25T19:18:12+00:00

My product uses a SQL Server database – each client has their own deployed

  • 0

My product uses a SQL Server database – each client has their own deployed instance on their own intranet. The db has about 200 tables. Most of them are configuration tables that have only a few rows, but there are a couple of transaction data tables which may have several million rows. Often I need to troubleshoot a customer’s configuration problem so I need a copy of their database to work with locally on my dev system… However it may be very large due to the transaction data, which makes it very difficult for the customer to send me a backup to work with. I need a way to backup/copy/export everything EXCEPT for the large tables.

Ideally, the large tables really belong a separate database catalog, such that a customer could backup their “data” separately from their “configuration”. However, I don’t have the authority to make that type of change, so I’m looking for a good way to export or copy just the configuration parts without having to copy the whole thing.

Currently I have a quick and dirty .NET app which uses a SQL Adapter and DataSet to blindly select * from all tables except the ones I want to omit, dump that to an XML file (this is my poor-man’s export feature). And I have companion app I can use locally to load the XML back into a DataSet and then use SQLBulkCopy to load it into my dev database. I had to do some tricks to disable constraints and so forth, but I made it work. This gets me the data, but not the schema…. ideally I’d like a way to get the schema along with it. It is a brute force approach, and I believe there must be a simpler way. Any suggestions for a better approach?

The solution needs to be automated since I’m dealing with end-users who generally have very little IT support.

(SQL 2005 and higher)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T19:18:13+00:00Added an answer on May 25, 2026 at 7:18 pm

    I solved it as follows. I created a custom winform app to export their data:

    1. use SMO (Transfer class) to script the entire schema to a .sql file
    2. loop through all specified tables (actually I just listed the large-growth ones to ignore, and process everything else) using: select * from
    3. capture the records into DataTable objects and dump them to .xml files
    4. Zip the whole folder up to be sent back to me

    And I have a custom winform app I use locally on my dev system to import the data:

    1. Create an empty database
    2. Run the .sql file to build the schema
    3. Disable all constraints on all tables (using sp_foreachtable)
    4. loop through all .xml file and bulk import them using SqlBulkCopy object
    5. Re-enable all constraints (using sp_foreachtable)

    This approach works well for my database, but I would not necessarily advise this for some database designs. In my case, there are many “small” configuration tables, and only a few “large” tables with minimal relations between them so I can easily ignore the large ones. If there were more complex relations it would probably not be a good solution…

    Seems to be working great so far. I was hoping to find a good way to do this without writing custom code, but I got it working with only a few hours of dev time.

    FYI, I almost got it working with sqlpubwiz, but the option to script data is all-or-nothing… you can’t ignore specific tables… that was a deal-breaker for my app.
    The Transfer object in SMO is a very useful class – it only requires a few lines of code to script an entire database schema including all dependencies in the correct creation order to recreate the database from scratch!

    http://msdn.microsoft.com/en-us/library/microsoft.sqlserver.management.smo.transfer.aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We've got a product that uses a Microsoft SQL Server database. We've got customers
I work on an Internet-facing, ASP.NET-based product that uses SQL Server 2005. Most customers
Simple situation. I've created an application which uses SQL Server as database. I could
We have a product that runs Sql Server Express 2005 and uses mainly ASP.NET.
Our application uses a large product database that is updated once a day. Updates
I wonder if anyone uses commercial/free java obfuscators on his own commercial product. I
Scenario Web server running an ASP.NET site that's connected to a sql server instance
I have a database running on MS SQL Server 2005 and an ASP.NET 3.5
We have a commercial software product under development. It supports Oracle, MySQL, and SQL*Server
So, I have an app that uses a SQL Server express db. I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.