Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

SQL 2005 Export Data

Posted on 2006-11-06
7
Medium Priority
?
1,282 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
Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

 
LVL 11

Accepted Solution

by:
regbes earned 1000 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

I have a large data set and a SSIS package. How can I load this file in multi threading?
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

609 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