Solved

SQL 2005 Export Data

Posted on 2006-11-06
7
1,280 Views
Last Modified: 2007-12-19
Hi Experts,

I have a problem where I'm trying to export data from a SQL 2000 box to my new SQL 2005 box. I've scripted all the tables / views / stored procedures / full text catalogues etc, no problems. When Exporting the data, it all transfers across fine but the uniqie ID's are changed. An example would be:

SQL 2000 DB
Table: tblUsers
UserID: 4
Username: Joe
Password: letmein
-----------------------------------------
SQL 2005 DB
Table: tblUsers
UserID: 1
Username: Joe
Password: letmein

As you can see, the UserID has changed for this user which doesn't help as you can imagine :/ This goes for all my tables. I've tried the "Database Copy" wizard but that doesn't work at all. I prefer to use the Data Export / Import anyway. Also, I don't have "Enable Identity Insert" enabled when transfering the tables.

Ta.
0
Comment
Question by:blandyuk
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
7 Comments
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 17881285
>>Also, I don't have "Enable Identity Insert" enabled when transfering the tables.<<
You will need to enabe this check box and include the Identity column in the transform.
0
 
LVL 9

Author Comment

by:blandyuk
ID: 17881440
I don't know what you mean by:
"and include the Identity column in the transform"

?? I include all columns in the transform. I've tried it with "Enable Identity Insert" with no luck :(
0
 
LVL 9

Author Comment

by:blandyuk
ID: 17881849
I found this article which is exactly the problem I'm having but I'm still having trouble as to what exactly I'm surposed to do:

------------------

>Question:<
I have a question regarding export / import when you have tables with  autonumber (identity) columns as primary surrogate keys. Does export / import retiain the values of these columns so that referential integriy is not broken?

>Answer:<
Yes!
Depending on how you import the data, make sure you choose the correct option that you wish to explicitely insert your "own values" into an IDENTITY column.
You might want to check BOL for SET IDENTITY_INSERT or BULK INSERT...KEEPIDENTITY or BCP -E. There is also some equivalent when you use DTS, but since I don't use DTS, I don't know what option to check there.

>Reference:<
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=78716&SiteID=1
0
Why You Need a DevOps Toolchain

IT needs to deliver services with more agility and velocity. IT must roll out application features and innovations faster to keep up with customer demands, which is where a DevOps toolchain steps in. View the infographic to see why you need a DevOps toolchain.

 
LVL 11

Accepted Solution

by:
regbes earned 250 total points
ID: 17881942
Hi blandyuk,

restoring a 2000 backup into the 2005 db is the easyest way to do this ( remember to change the compat level to 90 when done )

blandyuk,
> I don't know what you mean by:
> "and include the Identity column in the transform"

this means when it is not enabled new id's will be generated resulting in the behaviour you saw when it is enabled you (or the import process ) can assign the id a value from the exsisting data

HTH

R.


0
 
LVL 9

Author Comment

by:blandyuk
ID: 17882111
Found another article:

>Article:<
Enable identity insert is ignored when "optimize for multiple tables" is enabled. Unfortunately that option ensures that the import operation observes referential integrity between foreign key connected tables according to this blog: http://blogs.msdn.com/chrissk/archive/2006/06/24/645968.aspx.

Very, very, annoying.

>Reference:<
http://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=135905

Yeah, I'll have to restore it from a backup when I do it. I've already done this and I know it works. I've tried copying data without the "optimize for multiple tables" and it totally fails.

Ah well!
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 17883019
Sorry, I misunderstood the quesiton, I thought you were using DTS, I see now that it is SSIS that you are using.
0
 
LVL 9

Author Comment

by:blandyuk
ID: 17971134
Thanks regbes, I've just been creating a backup and restoring that now. I would have thought SQL 2005 Management Studio would have made is easy to transfer a database :/ It's easy in Enterprise Manager.

Doesn't matter anyway, sorted now.

Blandy
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question