begin transaction
begin
insert into BlogUsers(BlogName) values ('测试');
insert into Posts(PostTitle,BlogUserId,CreateTime,dd) values ('标题',SCOPE_IDENTITY(),'2016-10-14 00:00:00.000','true');
end
if @@error>0
begin
rollback transaction
raiserror('出错了',16,1)
return
end
commit transaction