Data Import

  • I want import data from one table to another(Different Database).I want to import data with all default values,all constraints.

    Please help to solve this issue.

    Thanks in advance.

    Thanks & Regards

    Sagesh.K 🙂

  • You could use Management Studio to script the table (in the object explorer click on the table, and select SCRIPT Table as ...) (it will include the extended properties, indexes, etc. but not everything.

    Alternatively there are third party tools that can take care of all the details and dependencies like rules, defaults, xml schema collections, ...

    Regards,

    Andras


    Andras Belokosztolszki, MCPD, PhD
    GoldenGate Software

  • I will assume it is SQL 2005. If yes, right click on the database name in SSMS. Go to Tasks->Export Data.... and hopefully from here, it should be self-explanatory for you....

  • Constraints internal to the table require scripting. If there are FKs to other tables, are you importing them?

    Andras mentions scripting it out, probably the easiest way, recreate the table in the new database, then you can export/import the data. The wizards make this easy.

    If you have to do this often, I'd really look at one of the Compare tools, like SQLCompare from Redgate or ApexSQL Diff for moving the objects and data easily.

  • Thanks for the reply.Actually I want to export the data through my application.I can't able to run the script in destination before export.Is there any other way which I can export data with constraints and default values.

    Thanks & Regards

    Sagesh.K

  • There is a way in SQL-DMO where you can script out objects. Google it...

    Once the scripts are generated, you can use bcp to pull and push the data. You would need to land the bcp files on a folder though....

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

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