???????洢?????????
????1.????????
????create procedure proc_select_officeinfo--(?洢??????)
????as select Id??Name from Office_Info--(sql???)
????exec proc_select_officeinfo--(????洢????)
????2.?????????
????create procedure procedure_proc_GetoffinfoById --(?洢??????)
????@Id int--(?????? ????????)
????as select Name from dbo.Office_Info where Id=@Id--(sql???)
????exec procedure_proc_GetoffinfoById 2--(?洢??????????????????????????????м????????)
?????:????????????????????????д????????????洫???????????????????????????????
????3.?????????????
create procedure proc_office_info--???洢????????
@Id int??@Name varchar(20) output--(?????? ????????)?????????????output
as
begin
select @Name=Name from dbo.Office_Info where Id=@Id --(sql???)
end
declare @houseName varchar(20) --?????????????????洢????????????
exec proc_office_info--(?洢??????)
4??@houseName output--(??????????output ????????@???? = OUTPUT?????????????д??)
select @houseName--(????)
????4.?????????
create procedure proc_office_info--???洢????????
@Id int--(?????? ????????)
as
begin
if(select Name from dbo.Office_Info where Id=@Id)=null --(sql???)
begin
return -1
end
else
begin
return 1
end
end
declare @house varchar(20) --?????????????????洢????????????
exec @house=proc_office_info 2 --(????洢??????????????????)
????--????????????洢????????int?????????