SQL Server 2008 R2 Data Export Problems

I am trying to export data from my production DB to my development DB but I am getting this error:

Messages Error 0xc0202049: Data Flow Task 1: Failure inserting into the read-only column "id". (SQL Server Import and Export Wizard)

Is there a way to check which column is that because I have 20 tables that all of them use the column name id or at least get a better error report?

Answers


Just click on Edit mappings when you choose tables to import from and to. and check on the Enable identity insert checkbox. And you should do that for each choosen table. Then you can complete your import. It was helped me in the same situation.


If the column ID is an identity column, it's likely set up to generate automatically when a row is inserted, and is not able to be directly written to.

To preserve linking from the production environment to the test, use:

SET Identity_Insert <TableName> ON

To allow you to write identity values.


All I had to do was:

  • Right-click on the column (in this case 'ID')
  • Select Modify
  • Inside the Column Properties scroll down until you see Identity Specification
  • Expand the view and select NO from the drop down menu.

If anyone knows a different (faster) way of doing this please share


Sounds to me as though you might be trying to insert values into a column that has been declared as an IDENTITY field.


Well, the answer is a bit late but I'm posting it anyway for the sake of providing to community.

I assume that you are trying to copy tables (not partial data). My answer is based on this assumption.

  1. Connect to the source db via Object Explorer in SSMS.
  2. Right click the db that you want its tables to be copied.
  3. Go to 'Tasks' --> 'Export'.
  4. Choose your source and destination server and if you don't want additional script to be run before hands just press next ('Copy data from one or more tables or views'). Now you may select tables you want to be copied to the destination.

Select tables that you want to be completely copied to the destination. And click on 'edit mappings'. Here you may 'enable identity insert'. You will also have other options so check the screen before pressing OK.

If you do not use an express edition of SSMS here you may create an SSIS package to create jobs and to automatize this process in the future. You may check 'run immediately' and follow the screen about how it goes with all the warnings and errors. Hopefully you will get none. Good luck!

Tested with:
(
    Microsoft SQL Server 2008 R2 (SP1) - 10.50.2500.0 (Intel X86) 
    Jun 17 2011 00:57:23 
    Copyright (c) Microsoft Corporation
    Enterprise Edition on Windows NT 5.2 <X86> (Build 3790: Service Pack 2)
)

Need Your Help

Visual Studio Command Prompt gives "\Common was unexpected at this time"

visual-studio visual-studio-2010 batch-file

I need to run MSBuild from the command line using the Visual Studio Command Prompt (2010). It used to work fine. Now when I open the window I get the following error message:

C: Why do unassigned pointers point to unpredictable memory and NOT point to NULL?

c pointers

A long time ago I used to program in C for school. I remember something that I really hated about C: unassigned pointers do not point to NULL.