Link to home
Start Free TrialLog in
Avatar of RBS
RBS

asked on

How to save an execute as a stored procedure so I can just run it

Hi:

I have a stored procedure that takes a number of parameters.  Rather than select the parameters each time, I'd just like to run it  - e.g. RunDefrag.

I tried to save as a stored procedure but go a grammar error.  

CREATE PROCEDURE [RunDefrag]
        EXECUTE dbo.dba_indexDefrag_sp
              @executeSQL           = 1
            , @printCommands        = 1
            , @debugMode            = 1
            , @printFragmentation   = 1
            , @forceRescan          = 1
            , @maxDopRestriction    = 1
            , @minPageCount         = 8
            , @maxPageCount         = NULL
            , @minFragmentation     = 1
            , @rebuildThreshold     = 30
            , @defragDelay          = '00:00:05'
            , @defragOrderColumn    = 'page_count'
            , @defragSortOrder      = 'DESC'
            , @excludeMaxPartition  = 1
            , @timeLimit            = NULL
            , @database             = 'testDB';

Any help in figuring how to do this would be greatly appreciated.

RBS
ASKER CERTIFIED SOLUTION
Avatar of ste5an
ste5an
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of RBS
RBS

ASKER

Duh - thanks (blush)

RBS