TSQL _STORE PROCEDURE

  • Hi all,

    I have to write storeprocedure program should create a file.if not just show these results when we run the SP

    store_sales store_stat.csv target

    Store Product Sales Store Avg Sales TV Avg SalesDVD

    S1 TV 456 S1 555 0

    S1 TV 654 S2 597 213

    S2 TV 849

    S2 TV 345

    S2 DVD 213

    can anyone help on this...

  • Kind of feels like homework..

    CEWII

  • maheshkrishnas (2/21/2012)


    Hi all,

    I have to write storeprocedure program should create a file.if not just show these results when we run the SP

    store_sales store_stat.csv target

    Store Product Sales Store Avg Sales TV Avg SalesDVD

    S1 TV 456 S1 555 0

    S1 TV 654 S2 597 213

    S2 TV 849

    S2 TV 345

    S2 DVD 213

    can anyone help on this...

    Odd requirements, probably is homework.

    You can output query results to a file using sqlcmd (you can look up the syntax in books online).

    As to why you'd like to output results to screen in the alternative... why would you want to do this?

  • maheshkrishnas (2/21/2012)


    Hi all,

    I have to write storeprocedure program should create a file.if not just show these results when we run the SP

    store_sales store_stat.csv target

    Store Product Sales Store Avg Sales TV Avg SalesDVD

    S1 TV 456 S1 555 0

    S1 TV 654 S2 597 213

    S2 TV 849

    S2 TV 345

    S2 DVD 213

    can anyone help on this...

    There are many ways to do this:

    1. Use SQLCMD

    2. Use BCP Utility

    3. Make a SSIS package & export the data to file


    Sujeet Singh

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

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