Best way to data dump specific columns?

  • I'm trying to avoid duplication, but I'm writing a stored procedure for a client that wants a nightly data dump for all of their data. This includes 39 columns from 17 tables, so it is NOT all of the data. Initially the procedure will be run manually so they can get all of the data to date, and then run it nightly after that for 24 hour periods.

    SQL Server 2005, 126 lines lines of code into the procedure, and only returning 30 of the 39 attributes that I need, I'm looking at 40k rows and taking 1:34 to run.

    I'm getting TONS of duplicate lines that just have a single column that is different. Is there a more efficient way of doing this other than giving them our entire database?

  • It really depends on what the client wants to see. How the database is designed, and how you are writing the query.

    Sounds as if there was no planning on the front-end and the back-end to not allow duplicate values.

    I would use a SSIS package for this work. That way I could have full control over what is happening. I would never use one large sproc for a data pump.

    Andrew SQLDBA

Viewing 2 posts - 1 through 2 (of 2 total)

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