December 16, 2009 at 12:06 am
Hi,
i'm quering the msdb..sysjobhistory and i'm having a job with the name of DB's.
my question is how i can query when i have a job with the name of DB's while i do cursor on the job name?
select step_name from msdb..sysjobhistory
where step_name = DB's
THX
December 16, 2009 at 12:23 am
Sorry, don't understand your question. Can you explain more?
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
December 16, 2009 at 1:06 am
how i can run this syntax when i have a job name that called DB's
this syntax not working because of the ' between the B and s
select step_name from msdb..sysjobhistory
where step_name = DB's
and i don't want to do that because i'm using a cursor on all the jobs name
select step_name from msdb..sysjobhistory
where step_name = 'DB''s'
December 16, 2009 at 1:10 am
Have a look at the QUOTENAME function. It should do what you want.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
December 16, 2009 at 1:32 am
maybe you can hep me different approach
i want to retrieve the last top 10 history job from the msdb..sysjobhistory for each job.
how i can write this syntax?
THX
December 16, 2009 at 2:40 am
I'd start by using RowNumber partitioned by the jobid and ordered by the date. Then you can select where that is <=10
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
December 16, 2009 at 2:59 am
can you help here with a little start example of the script that i'm looking for?
THX
December 16, 2009 at 3:54 am
Have a look here. Example B is almost exactly what you want to do.
http://msdn.microsoft.com/en-us/library/ms186734.aspx
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply