How do I modify a stored procedure to produce results in a designated file

Eli Schneider 20 Reputation points
2023-01-27T19:56:08.04+00:00

How do I modify a stored procedure to produce results in a designated file. I'm happy with the results I get on a grid in SSMS. I'd like to obtain these results in a designated file while running in visual studio express. I can acheive this result by using datasets but this is not the most efficient way of doing what I want.

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,691 questions
0 comments No comments
{count} votes

Accepted answer
  1. JIAN WANG 335 Reputation points
    2023-01-27T20:42:52.6166667+00:00

    depends on how do you want to run the store procedure.

    for example, use xp_cmdshell, and specif/define the destination.

    or create sql agent job to combine batch, or powershell script .

    or add a separated SSIS project if you use visual studio and you want to manupulate the SSIS project result...

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Jingyang Li 5,891 Reputation points
    2023-01-27T21:09:24.0166667+00:00

    You can use SSIS to create the file you need. (execute the stored procedure inside the package.).

    0 comments No comments