请问SQL中GOTO ERROR是什么意思?

来源:百度知道 编辑:UC知道 时间:2024/06/06 10:47:49

USE pubs
DECLARE @num int
IF @num = 0
GOTO Err
ELSE
BEGIN
PRINT 'authors found'
--select * from authors
--GOTO Last
GOTO Err
END
Err: PRINT 'no authors found'
Last: PRINT 'Finish execution'
GO

看看这个程序,GOTO执行的是当if条件成立时的,跳转。方向时err

GOTO为跳转语句,ERROR是错误,检查一下吧