Executing a batch query from a procedure

  • Is it possible to execute a batch query which is stored on the server from a Store Procedure? The query is in directory "E:\Live_restore\queries"

  • Yes, you can using xp_cmdshell and OSQL / sqlcmd. If xp_cmdshell is disable you can configure it using sp_configure /from SAC.

  • karen.rogers (7/17/2008)


    Is it possible to execute a batch query which is stored on the server from a Store Procedure? The query is in directory "E:\Live_restore\queries"

    thats right, you can use

    xp_cmdshell 'dir /S E:\Live_restore\queries'

    🙂

  • karen.rogers (7/17/2008)


    Is it possible to execute a batch query which is stored on the server from a Store Procedure? The query is in directory "E:\Live_restore\queries"

    thats right, you can use

    xp_cmdshell 'dir /S E:\Live_restore\queries'

    🙂

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

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