Question : could not find stored procedure 'sp_add_jobserver'

i need to run a t-sql statement in a maintenance plan. the t-sql is written and functions correctly from query analyzer but i get an error message that i need to specify sp_add_jobserver for it to run in the maintenance plan. when i add this line into query analyzer with teh correct parameters i get the error message Msg 2812, Level 16, State 62, Line 2
Could not find stored procedure 'sp_add_jobserver'.

here is my query:

Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
use master 
exec sp_add_jobserver @job_name = 'DBBackup.DBBackup' , @server_name = 'csvmsql2005'
 
DECLARE @DBName sysname
DECLARE @PrevDBName sysname
DECLARE @sql nvarchar(255)
DECLARE @StartName sysname
DECLARE @EndName sysname
 
SET @StartName = ''
SET @EndName = 'zzzzzzzzzzzzzzzzzzz'
 
SELECT TOP 1 @DBName = name FROM master.dbo.sysdatabases 
WHERE sid <> 0x01 AND name BETWEEN @StartName AND @EndName
ORDER BY name
WHILE @DBName IS NOT NULL
BEGIN
  PRINT 'Processing database ' + @DBName
  IF databasepropertyex(@DBName,'recovery') = 'FULL'
  BEGIN
    Print '  Recovery Mode is ' + convert(varchar,databasepropertyex(@DBName,'recovery')) + '. Setting it to SIMPLE.'
    SET @sql = N'ALTER DATABASE ' + CONVERT(nvarchar,@DBName) + N' SET RECOVERY SIMPLE'
    EXEC sp_executesql @sql
  END
  ELSE
    Print '  Recovery Mode is ' + convert(varchar,databasepropertyex(@DBName,'recovery')) + '.'
  
  SET @PrevDBName = @DBName
  SET @DBName = NULL
  SELECT TOP 1 @DBName = name FROM master.dbo.sysdatabases 
WHERE sid <> 0x01 AND name BETWEEN @StartName AND @EndName
AND name > @PrevDBName 
ORDER BY name
END
Open in New Window Select All

Answer : could not find stored procedure 'sp_add_jobserver'

sp_Add_jobServer  does not exist in master db, it is in msdb


use master
exec msdb.dbo.sp_add_jobserver @job_name = 'DBBackup.DBBackup' , @server_name = 'csvmsql2005'
Random Solutions  
 
programming4us programming4us