export to files or tables from same database

  • I want to exportv 100+ tables (plus data) to a 2nd database in the same server. But I have to make sure the tables exist before doing this export. I dont want someone to drop the table in the source table and break my SSIS package. Thanks

  • if exists(select * from sysobjects where name = 'Yourtable1')

    begin

    ....do data transfer here....

    end

  • write that 100+ times?

  • Well you are transferring data 100 + times right

  • Are the 100+ tables all the tables in the database? Just wondering if you could set up a dataflow that pulls all the names from sys.objects into a temp table/table variable, then select from that for your datareader/OleDb source. Once you have a pipeline of all required table names, just use an OleDBCommand for each row, that does the backup using the current table name as supplied row-by-row from the pipeline.

    Or use error handling. Remember SQL2005 does have try/catch - Just do your backup within a try block, and have some logging of errors within the catch block?

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

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