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
 Transact-SQL (2000)
 Order of process question

Author  Topic 

jose1lm
Yak Posting Veteran

70 Posts

Posted - 2005-05-11 : 11:52:05
I've created a job task and in this task is a T-SQL statement.


USE [IsoMatrix]
Declare @users varchar(8000)
SELECT @users = COALESCE(@users + '; ', '') + 'exec sp_mail_upd_notify_sup '''+
CAST(pin AS varchar(15)) + ''''
FROM [dbo].[iso_tmpmail]
WHERE notify IS NOT NULL AND emailed_dt IS NULL AND (CONVERT(varchar, log_date, 101) = CONVERT(varchar, GETDATE() - 1, 101))
GROUP BY pin, CONVERT(varchar, log_date, 101)

exec (@users)

GO

USE [IsoMatrix]
update [dbo].[iso_tmpmail] set emailed_dt = GETDATE() WHERE emailed_dt IS NULL AND
notify IS NOT NULL AND (CONVERT(varchar, log_date, 101) = CONVERT(varchar, GETDATE() - 1, 101))


The question I have is, will the last statment (after the 'Go') be executed right after the first statement is done? Or does it also wait until the stored procedure that was executed is complete, then it resumes to the last statment?

Did I make sense? :/

Jose
   

- Advertisement -