Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 select * from msdb.dbo.sysjobs_view...

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2003-03-21 : 06:56:35
Jake writes "Windows 2000 Server
SQL Server 2000

I am trying to dynamically schedule my own job through a stored procedure. I have tried using sp_update_jobschedule passing it the job_id (uniqueidentifier), but the line:

select * from msdb.dbo.sysjobs_view where (job_id = @job_id)

always returns zero records.

Now i am certain my @job_id is a valid value. Regardless, i then tried placing the following line in my stored proc (just for testing):

if exists( SELECT * FROM msdb.dbo.sysjobs_view )

and that always returns false. (but of course when i open the view using enterprise manager, it has bunches of records)

If you can help, I would greatly appreciate it.

thanks
jake"

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-03-21 : 13:14:49
I just ran the select statement and I get my two jobs back that I have scheduled. I also get true back for the if exists. I don't have any clue what could be the problem. Have you tried using sysjobs instead of sysjobs_view?

Tara
Go to Top of Page

jasper_smith
SQL Server MVP & SQLTeam MVY

846 Posts

Posted - 2003-03-22 : 10:28:16
Do you own the job you are trying to update (or if not are you a sysadmin) ? sysjobs_view will only return jobs your login owns unless you are a member of the sysadmin fixed server role or the fixed database TargetServersRole role in msdb.


HTH
Jasper Smith

0x73656c6563742027546f6f206d7563682074696d65206f6e20796f75722068616e6473203f27
Go to Top of Page
   

- Advertisement -