Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Export option (right click in the database - tasks - export data...)


Export option (right click in the database - tasks - export data...)

Author
Message
river1
river1
Ten Centuries
Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)

Group: General Forum Members
Points: 1040 Visits: 1361
Hi,

In the past (SQL Server 2000) when i used the export option (right click in the database name, to export objects to other database) if i wanted to send a table from one database to other, i could send the primary key, create the identity fileds as the source table in the destination database.

I have searched for this option in SQL Server 2005, but it i think that it does not exist, as far as i can see, i can only send the table from the source database to the destination database , but i can not send the primary and the indexes and the Identity field to it, am i right?


Thank you
Paul White
Paul White
SSChampion
SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)

Group: General Forum Members
Points: 11082 Visits: 11353
Blink Do you want to take another shot at explaining that? Blink

It is possible to do many things with the export data tool - I just need to understand the requirement a bit more. A simple example with a table schema and some example rows of data at both ends would probably help.



Paul White
SQLPerformance.com
SQLblog.com
@SQL_Kiwi
river1
river1
Ten Centuries
Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)

Group: General Forum Members
Points: 1040 Visits: 1361
lol, ok, i will try to explain better.

I have a table, this table as 4 columns. The first column (int) is an identity field and it's the primary key.

When i use the export data tool (to send the table to other database), i can send the table, but i cannot create in the destination database the primary key and the identity field.


Thanks,

Pedro
Paul White
Paul White
SSChampion
SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)

Group: General Forum Members
Points: 11082 Visits: 11353
river1 (3/18/2010)
When i use the export data tool (to send the table to other database), i can send the table, but i cannot create in the destination database the primary key and the identity field.

Thank you Pedro. Just to be absolutely clear, you want to transfer the whole table, including the column with the IDENTITY property, and re-create the primary key. The IDENTITY column should retain the same values too...right?



Paul White
SQLPerformance.com
SQLblog.com
@SQL_Kiwi
river1
river1
Ten Centuries
Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)

Group: General Forum Members
Points: 1040 Visits: 1361
No, the identity does not need to retain the same values. I just need to recreate the whole table (primary key and identity)
Paul White
Paul White
SSChampion
SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)

Group: General Forum Members
Points: 11082 Visits: 11353
river1 (3/18/2010)
No, the identity does not need to retain the same values. I just need to recreate the whole table (primary key and identity)

There is no way I can see to create the primary key - you would have to script that from SSMS.

To transfer the data, click the Edit Mappings button (on the table selection screen) and select the Enable Identity Insert option.

To transfer the structure without the data, choose the 'Write A Query' option and write something like SELECT * FROM dbo.Table1 WHERE 0 = 1;
Change the name from dbo.Query to dbo.Table1, and do the same trick as before with the Edit Mappings button / Enable Identity Insert.

Alternatively, if the table is small, script it from SSMS (Tasks...Generate Scripts), specifying the indexes to include, and also the Script Data option.

Paul



Paul White
SQLPerformance.com
SQLblog.com
@SQL_Kiwi
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search