Dim backUpDB2 As SqlClient.SqlCommand
backUpDB2 = New SqlClient.SqlCommand
backUpDB2.CommandType = CommandType.StoredProcedure
backUpDB2.CommandText = "msdb.dbo.SP_RESUMENFAC"
backUpDB2.Connection = SqlConnection1
backUpDB2.ExecuteNonQuery()
The SP has this
CREATE PROCEDURE .[SP_RESUMENFAC] AS
EXEC sp_start_job @.job_name = 'TransferirDatos(FACT) '
GO
WHen I execute the page after the SP it fills some datagrid but the data is not updated bacuase the job takes 1 minute or more to finish.
Is there anyway to prevent to show the old data? or to detect when the job has finished?
ThanksI think i would look for a way to get the execution status of the job instead.
If the job is not in an idle state, you can display something appropriate on the page.
look atsp_help_job
@.execution_status will tell you what the job is doing...
0 Returns only those jobs that are not idle or suspended.
1 Executing.
2 Waiting for thread.
3 Between retries.
4 Idle.
5 Suspended.
7 Performing completion actions.|||it says COuldnt Find Procedure.
Should I install something on the server. Its Sql Serrver 7 I think.|||its in MSDB
USE msdb
EXEC sp_help_job|||use msdb
EXEC sp_start_job @.job_name = 'TransferirDatos(FACT) '
This is the job, How can I Know when this has done and show a progress bar?|||side note: Don't prefix your procs with "sp_" this should be reserved for MS procs only and you'll get stung performance wise if you don't remove it.|||if your stored proc looks like this:
USE msdb
EXEC sp_help_job NULL, ''TransferirDatos(FACT)' ,'JOB'
you will get back a single recordset.
Look at thecurrent_execution_status column for the jobs status.
My prev post has the different results for this column.
you wont get progress (like 50% complete etc...)
but you will get Executing or Idle etc...
No comments:
Post a Comment