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 6816001
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:52:26+00:00 2026-05-26T20:52:26+00:00

I am developing a Grails-application which uses several databases, others are read-only and 1

  • 0

I am developing a Grails-application which uses several databases, others are read-only and 1 is the app’s sort of a “main db”. Additionally there are multiple environments: dev, qa, prod. qa is used for release-testing and is identical to prod.

Always before release-testing I need to overwrite the “main” qa-database with “main” prod-database. I don’t have other than SQL-user access to the server running MS SQL instance.

What I need is the magic that drops everything in qa-database without dropping the database itself and imports everything from the prod-database. Databases contain a lot of foreign key constraints.

How to achieve the aforementioned?

P.S.

I did this on MySQL but now we’ve migrated to MS SQL. My MySQL-script goes somewhat like this (pseudo):

SET foreign_key_checks = 0;
-- Drop all tables..
SET foreign_key_checks = 1;
-- Import prod-dump to DB..
  • 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-26T20:52:27+00:00Added an answer on May 26, 2026 at 8:52 pm

    You shouldn’t do this in straight T-SQL.

    You really should use something like SMO Scripting in .NET to export objects in this way. There is NO clean way to do what you are asking in pure SQL code.

    There are too many variables to account for if you plan to just build dynamic SQL from system tables, which is the only way to approach this in T-SQL.

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

Sidebar

Related Questions

I am developing a application in grails which uses lot of ajax.In one part
I am developing a grails application which uses lot of ajax.If the request is
I am developing a web application in grails which uses lot of ajax.I need
I am developing grails application which uses file searching.For that I wrote the following
I'm developing a Grails App. I have about 20 Controllers right now and there
Hy, I'm developing a Grails app which has to communicate with an existing Java
We're developing an app (using Grails Spring Security (formerly Acegi)) in which we'll have
I am developing a grails application which has codenarc plugin. And also I am
I am developing a grails app and was wondering if there is any grails
Developing a brand new schema/app which uses hibernate to create tables from pojo's. My

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.