• Informer30 (4/28/2014)


    Hi Sean,

    thanks for reply, please let me know what further information is required...

    I have a select statement that I need to run 15 times with a different where clause and the output to be excel.

    SSIS will ideal going forward, for now I need to cater for the previous 18 months. Rather than running 15 select statements for 18 months = 270 statements I trying to find a quick to run these statements and save me a lot of time...

    Thanks

    Unless you are willing to provide details we can't help. Keep in mind that I can't see your screen, I have no idea what your tables are like, I have no idea what you are trying to accomplish. I only know what you have posted, which is next to nothing. In your second post you have added details about "catering for the previous 18 months". I have no idea what that means. Do you need to adjust your where clause to have some date checks? You say you need to adjust your where clause slightly. Does that mean you need to use a different value for the same column or do the columns being filtered changed? I am not saying you need to post your entire enterprise structure here but you must post enough details so that we know what the question is. At this point, all I know is that you want some help trying to figure out how to automate running some queries that need to change a little bit for each select statement.

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/