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

  • 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

  • :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.

  • 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

  • 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?

  • No, the identity does not need to retain the same values. I just need to recreate the whole table (primary key and identity)

  • 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

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply