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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:28:03+00:00 2026-06-12T09:28:03+00:00

When generating database scripts, I’m scripting data to be migrated to a different environment.

  • 0

When generating database scripts, I’m scripting data to be migrated to a different environment. Is there a setting in the script generation that I can enable to set IDENTITY_INSERT on/off automatically so I don’t have to go through each table manually in the generated script and set it? I’m using SSMS and I’d like to do this via SSMS.

Here’s what I am getting:

INSERT my_table (my_table_id, my_table_name) VALUES (1, 'val1');
INSERT my_table (my_table_id, my_table_name) VALUES (2, 'val2');

Here’s what I want:

SET IDENTITY_INSERT my_table ON
INSERT my_table (my_table_id, my_table_name) VALUES (1, 'val1');
INSERT my_table (my_table_id, my_table_name) VALUES (2, 'val2');
SET IDENTITY_INSERT my_table OFF
  • 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-06-12T09:28:04+00:00Added an answer on June 12, 2026 at 9:28 am

    You didn’t say what tool you are using to generate your scripts, but if you have a tool like Red-Gate Data Compare, it will generate these statements for you, if you include the auto-increment field in the comparison. I’m not aware that SSMS has any such option.

    If you have Visual Studio Premium or Ultimate edition, then you also have access to DBPro (Database Professional) that has a data compare and synchronization option. I believe this will generate the IDENTITY_INSERT statements for you as well.

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

Sidebar

Related Questions

When I'm generating my database scripts for my project I'd like to manage the
I have a SQL Server 2008 database which contains data that I need to
I have a PHP script that is generating a MySQL select statement: select *
A PHP script is generating the following table panel based on the data from
I gave generating test data a first shot by trying to populate my database
I've written a database generation script in SQL and want to execute it in
I'm using for my projects a rather complete UI auto-generation tool from database entities
I'm writing a simple code generation application to build POCO's from a DB2 database
Generating normal columnar data in excel file is quite easy but does any one
I am generating a checklist based on mysql data in an HTML form. When

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.