if object_id('checklower') is not null drop procedure checklower go create procedure checklower @height dec as if @height=0 begin print'error,cannot zero' return end else begin transaction select sno,sname,sex,height from students where students.height<=@height commit print'have do it' go
不知道你表students结构,当然看起来是没错的啦.但我有点疑问? begin transaction select sno,sname,sex,height from students where students.height<=@height commit你只是取数据,用事务没有意义吧?
drop procedure checklower
go
create procedure checklower
@height dec
as
if @height=0
begin
print'error,cannot zero'
return
end
else
begin transaction
select sno,sname,sex,height from students where students.height<=@height
commit
print'have do it'
go
begin transaction
select sno,sname,sex,height from students where students.height<=@height
commit你只是取数据,用事务没有意义吧?