mingfattt
asked on
timer SQL
following is my code
declare @testing varchar(255)
declare @testing2 varchar(255)
set @testing = '4'
set @testing2 = '5'
print @testing
exec master..xp_cmdshell 'net send agmpimo258 ayam'
if @testing = '4'
runCmds:
WAITFOR DELAY '00:00:04' --pauses for 1 minute
print @testing2
well above is the example of the code.. i am trying to delay the program when the condition meet the if statement but when i write in that way the whole program will get delay eventhough the condition is not full filled.. please advise....thanx very much
declare @testing varchar(255)
declare @testing2 varchar(255)
set @testing = '4'
set @testing2 = '5'
print @testing
exec master..xp_cmdshell 'net send agmpimo258 ayam'
if @testing = '4'
runCmds:
WAITFOR DELAY '00:00:04' --pauses for 1 minute
print @testing2
well above is the example of the code.. i am trying to delay the program when the condition meet the if statement but when i write in that way the whole program will get delay eventhough the condition is not full filled.. please advise....thanx very much
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
concur with itsvictk
IF statements apply to the next statement or block of statement following it. thus multiple statements must be made into a block of statements by wrapping in BEGIN and END
IF statements apply to the next statement or block of statement following it. thus multiple statements must be made into a block of statements by wrapping in BEGIN and END
ASKER
well... i realize that the code is work but here what i mean.... the message for the print @testing is coming out after four seconds and together with the print @testing2 well let say my case is i have the bundle of file... now i want to detect whether the file is exist and if not the stored procedure will delay for certain particular of time... is this work... please clarity fhanx and appreciated...
itsvtk