-
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'.
-
Add 'print @cmd' in the sp to see what does @cmd look like.
-
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
-
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
-
Forum Rules
|
|