2017-12-18 8 views
0
create procedure spGetEmployeByDepartmentIdCount 
@DepartmentIdType int , 
@DepartmentIdCount int output 
as 
Begin 
     select count(id) 
     from tblemploye1 
     where @DepartmentIdType = id  
End 

Declare @DepartmentIdCount int 
Declare @id int 
set @id = 1 
Execute spGetEmployeByDepartmentIdCount @id, @DepartmentIdCount output 
print @DepartmentIdCount 
+0

함수를 사용하면 값 –

+1

이 반환되므로 문제가 발생합니까? – Sunil

+0

그것은 문제가 될 수 있습니까? –

답변

0

저장 프로 시저는 데이터를 를 선택 반환,

당신은 당신의 저장을 변경할 수 있습니다

NULL입니다 프로 시저 코드가

도움이 나는 희망 ALTER 문 이제 출력 매개 변수가 선택 부서 직원의 수와 할당

select 
    @DepartmentIdCount = count(id) 
from tblemploye1 
where 
    id = @DepartmentIdType 

을 사용하여 다음과 같은