Results 1 to 15 of 19

Thread: Error message

Hybrid View

  1. #1
    Join Date
    Sep 2002
    Posts
    5,938
    You didn't let your sp to accept variable, try following:

    CREATE PROCEDURE usp_sp1
    @DatabaseName sysname

    AS

    DECLARE @cmd varchar(500)

    set @cmd = 'master.dbo.xp_sqlmaint ''-S server -U user -P password -D ' + @DatabaseName + ' -PlanName Optimization ' + @DatabaseName + ' -Rpt C:\MaintPlanRpts\OptimizationFor ' + @DatabaseName + ' -DelTxtRpt 1DAYS -WriteHistory -RebldIdx 10 -RmUnusedSpace 50 10 '''

    exec (@cmd)

  2. #2
    Join Date
    Mar 2006
    Posts
    127
    I tried that and in query analyzer I executed it like this:

    execute msdb.dbo.usp_RebuildIndexes 'DBName'

    Error message:

    (28 row(s) affected)

    Server: Msg 22029, Level 16, State 1, Line 0
    sqlmaint.exe failed.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •