For Programmers: Free Programming Magazines  


Home > Archive > SQL Server Programming > February 2005 > PK Index name









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author PK Index name
simon

2005-02-26, 4:00 pm

I have table tipDok with primary key, which is varchar data type.

The name of the index(primary key) is generated automatically and is:

PK__TipDOK__1EC48A19

I select: ALL tasks- Export data in enterprice manager and copy objects
option and then select this table to be copied to some other database.

The table is copied successfully and is identical, only the name of index is
now different:

PK__TipDOK__267ABA7A

Why?

I would like that also the name is identical.
Because I have program for comparing the datatbases and it gives me the
difference between this table just because of the index name.
Then I have errors when I synchronize databases, because the index can't
be dropped.

Any idea?

lp,
Simon


mark baekdal

2005-02-26, 4:00 pm

what you need is a program that recognises that the primary keys are the same
and only the name is different so it renames the key. DB Ghost
(http://www.dbghost.com) does this and does it for foreign keys as well.

"simon" wrote:

> I have table tipDok with primary key, which is varchar data type.
>
> The name of the index(primary key) is generated automatically and is:
>
> PK__TipDOK__1EC48A19
>
> I select: ALL tasks- Export data in enterprice manager and copy objects
> option and then select this table to be copied to some other database.
>
> The table is copied successfully and is identical, only the name of index is
> now different:
>
> PK__TipDOK__267ABA7A
>
> Why?
>
> I would like that also the name is identical.
> Because I have program for comparing the datatbases and it gives me the
> difference between this table just because of the index name.
> Then I have errors when I synchronize databases, because the index can't
> be dropped.
>
> Any idea?
>
> lp,
> Simon
>
>
>

Adam Machanic

2005-02-26, 4:00 pm

In Enterprise Manager, right-click on your database, select All Tasks, then
Generate SQL Script.

Select whatever tables you want to copy, then go to the Options tab and make
sure "Select PRIMARY keys, FOREIGN keys, defaults, and check constriants" is
selected.

Use the script this generates to create a new, empty database. Then you can
use the DTS wizard to copy the data in from the old database.


--
Adam Machanic
SQL Server MVP
http://www.sqljunkies.com/weblog/amachanic
--


"simon" <simon.zupan@iware.si> wrote in message
news:iQ%Td.9584$F6.1864547@news.siol.net...
> I have table tipDok with primary key, which is varchar data type.
>
> The name of the index(primary key) is generated automatically and is:
>
> PK__TipDOK__1EC48A19
>
> I select: ALL tasks- Export data in enterprice manager and copy objects
> option and then select this table to be copied to some other database.
>
> The table is copied successfully and is identical, only the name of index

is
> now different:
>
> PK__TipDOK__267ABA7A
>
> Why?
>
> I would like that also the name is identical.
> Because I have program for comparing the datatbases and it gives me the
> difference between this table just because of the index name.
> Then I have errors when I synchronize databases, because the index can't
> be dropped.
>
> Any idea?
>
> lp,
> Simon
>
>



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com