Page 2 of 2 FirstFirst 12
Results 16 to 19 of 19

Thread: Error message

  1. #16
    Join Date
    Mar 2006
    Posts
    127
    I have modified my sp a little bit and I am getting a different error.

    Sp:




    ALTER PROCEDURE usp_sp1
    @DatabaseName varchar(20)


    AS

    DECLARE @cmd varchar(500)


    set @cmd = 'master.dbo.xp_sqlmaint -Rpt "C:\MaintPlanRpts\OptimizationFor ' + @DatabaseName + '" -DelTxtRpt 1DAYS -WriteHistory -RebldIdx 10 -RmUnusedSpace 50 10'
    exec (@cmd)

    Error msg:

    Server: Msg 170, Level 15, State 1, Line 1
    Line 1: Incorrect syntax near 'Rpt'.

  2. #17
    Join Date
    Sep 2002
    Posts
    5,938
    Add 'print @cmd' in the sp to see what does @cmd look like.

  3. #18
    Join Date
    Mar 2006
    Posts
    127
    Here is the results:

    Server: Msg 170, Level 15, State 1, Line 1
    Line 1: Incorrect syntax near 'Rpt'.
    master.dbo.xp_sqlmaint -Rpt "N:\MaintPlanRpts\Optimization For VCSPortalDev.txt" -DelTxtRpt 1DAYS -WriteHistory -RebldIdx 10 -RmUnusedSpace 50 10

  4. #19
    Join Date
    Sep 2002
    Posts
    5,938
    You should check syntax in books online (search for 'sqlmaint Utility') before making changes. The other way is build plan in em and check how the command looks like in sql job.

Posting Permissions

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