Creating a file from within stored procedure

  • Without executing master..xp_cmdshell, does anyone have any suggestions on how to create a file from within a stored procedure?  The file will be the results of a query dynamically created in the stored procedure.

     

    Thanks,

    Jeff


    "Keep Your Stick On the Ice" ..Red Green

  • One thing that comes to mind are the sp_OA* procedures. But they certainly have a huge downside.

    What about doing this at the client?

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

  • You could use an extended stored proc to write a file from within a stored proc, but this would probably be an overkill...

     

    --

  • Frank.........I've been offline for awhile with a job change.  Good to see you lurking out here.   The client is probably going to have to do this, but I have been sent on a quest to see if there is a way to execute a DTS package within a proc w/out using xp_cmdshell.  I don't think there is and it is hard to prove a negative so I generalized my question and posted.

     

    Diwakar....I thought about the extended stored proc after I posted and your probably right about the overkill.   I'm not sure of the skillset of the people working on this application either.  It may confuse them even more.

    I'll check up on the sp_OA...s Not familiar with these.

    Thanks All!!


    "Keep Your Stick On the Ice" ..Red Green

  • Jeff,

    How about creating a job without a schedule for the DTS and then start the job from within the procedure ?

  • How about seting up a file has a linked server using a flat text file ODBC driver? OR something along those lines. Treat the file has a single column table and write to it.

  • Frank.........I've been offline for awhile with a job change. Good to see you lurking out here. The client is probably going to have to do this, but I have been sent on a quest to see if there is a way to execute a DTS package within a proc w/out using xp_cmdshell. I don't think there is and it is hard to prove a negative so I generalized my question and posted.

    Hope everything's fine with the new job!

    Just another thought. You might find something useful on here

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

  • Consider using a WebTask (See sp_makewebtask, sp_runwebtask in BOL).

     

    DOM

Viewing 8 posts - 1 through 7 (of 7 total)

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