• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 625
  • Last Modified:

Primary key lost when exporting the data

Hi Experts

I have a database on my local server and an another database on my isp side. To run my web sites i have to upload the data to my host isp. I have only the export and import rights. The problem is that i have primary keys in my tables on my local database. The movement i export the data to my isp server all the primary keys are lost. I tried the similar thing by exporting data to an another local server. The result is same. Is this a big bug in the sql server or there is any way to solve the same. Remember i donot have the rights to take the backup of the database or restore it.

With Regards

Loveneesh Bansal
0
loveneesh_bansal
Asked:
loveneesh_bansal
  • 4
  • 3
1 Solution
 
rupertsCommented:
I haven't tried this, but I assume that you have the IDENTITY property on for the primary key field.

You'll have to turn it off for the insert on the target machine, and then afterwards (if needed) put it back on again.
0
 
UncleMattCommented:
how are you importing the data?

if you are using DTS there is a set identity insert on option when you select the tables i believe.

if you are using linked servers and doing it that way then use:

set identity_insert on

Matt.
0
 
loveneesh_bansalAuthor Commented:
dear UncleMatt i have tried the same but still the result is same. I suppose it is a big bug in sql server .

loveneesh
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
UncleMattCommented:
i've done this same thing myself, so it's not a bug in the server, what versions of SQL Server are you using, are they both the same.  

If you are using DTS what options are you setting.

let us know more information and i might be able to help.

Matt.
0
 
loveneesh_bansalAuthor Commented:
Dear Unlcematt

I am using sql server 2000. To test the things i had created two database. In the first database name as test i had made a table name as one. Under this table i have only one field name as id. This is the primary key. Now hen i used the enterprise edition of sql server and from the second database i import this table. When i saw the design from this database the primary key was not there.

Please help me for the same.

loveneesh
0
 
UncleMattCommented:
when you setup the dts package, there is a choice that i can't remember all of, but the bottom of the three cohoices is something like transfer objects between sql servers.

If you make sure you use this selection, and then in options make sure indexes is selected, it should transfer all the data like you want it to.

if not, post a step through of exactly what you do in each step of DTS and i can check to see if there is something you are missing.

Matt.
0
 
loveneesh_bansalAuthor Commented:
Thanks unclematt.



0
 
loveneesh_bansalAuthor Commented:
Sorry Uncle matt

I am accepting your answer very late. Thanks for your kind support
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now