Of Interest
Business Intelligence and Analytics
Oracle Training
|
Sybase
»
T-SQL
»
exit
»
abort
Aborting a T-SQL script
Ability to exit/abort a SQL script:
The below script will exit if the count is zero, part 2 will no execute.
Note that flushmessage is needed to see output here
set flushmessage on
go
set nocount on
go
declare @count1 integer
select @count1 = count(1) from company_account
select @count1
if (@count1 = 0)
begin
print "Exit condition found ..."
select syb_quit()
end
go
print 'Part 2 of script'
go
select count(1) from company_invoice
go
|
|
|
Get the latest Rocket99 news and tech tips via
|