34,838
社区成员




begin try
insert into table(fieldName) values(fieldValue);
return @@rowcount;
end try
begin catch
return -255;
end catch
DECLARE @Flag INT
begin try
insert into table(fieldName) values(fieldValue);
SET @Flag=0
end try
begin catch
SET @Flag= -255;
end CATCH
RETURN @Flag
-- 不会的,不建议把这个放在一个过程中
create table test(id int)
go
create proc pr1
as
begin
begin try
insert into test(id) values(100);
return @@rowcount;
end try
begin catch
return -255;
end catch
end
go
declare @ret int
exec @ret = pr1
print @ret
go
drop proc pr1
go
drop table test
go
1