June 11, 2008 at 3:37 pm
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
June 12, 2008 at 1:12 am
if exists(select * from sysobjects where name = 'Yourtable1')
begin
....do data transfer here....
end
June 12, 2008 at 1:14 pm
write that 100+ times?
June 13, 2008 at 12:58 am
Well you are transferring data 100 + times right
June 13, 2008 at 3:34 am
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