I have 2 stored procedures, it has different columns from 2 different tables. I want to count the results(no. of rows) of these 2 stored procedures by creating the temporary table But I don't know how to pull this. 1st procedure:
CREATE PROCEDURE [dbo].[setable_workflowtable]
@techteam nvarchar(100) = NULL
AS
BEGIN
SELECT
s.SecurityExceptionID, s.SecurityExceptionInfoID,
w.WorkflowID ,s.CatalogueType,
s.CatalogueSubType, s.EofE,
s.EofEID, s.UserWhoCreated, s.DateCreated,
w.TechTeam, w.WorkflowSystemStatus,
w.NextActionByUser, w.CurrentStatus, w.NextActionBy,
NULL AS 'dummy1', NULL AS 'dummy2', NULL AS 'dummy3',
NULL AS 'dummy4'
FROM
WorkflowTable w
INNER JOIN
SETable s ON w.SecurityExceptionID = s.SecurityExceptionID
WHERE
w.currentstatus = 'Started'
AND w.WorkflowSystemStatus != 'SecurityTeamApproved'
AND w.NextActionBy = 'TechUser'
AND w.TechTeam = @techteam
ORDER BY
datecreated DESC
END
[setable_workflowtable] 'CloudTeam'
2nd procedure:
CREATE PROCEDURE [dbo].[setable_setask]
@techteam nvarchar(100) = NULL
AS
BEGIN
IF (@techteam IS NULL OR @techteam = 'All')
BEGIN
SELECT
setask.*,
setable.SecurityExceptionInfoID, setable.CatalogueType,
setable.CatalogueSubType, setable.EofE,
setable.UserWhoCreated, setable.EofEID,
NULL AS 'dummy1', NULL AS 'dummy2',
NULL AS 'dummy3', NULL AS 'dummy4'
FROM
SETask setask
INNER JOIN
SETable setable ON setask.SecurityExceptionID = setable.SecurityExceptionID
END
ELSE
BEGIN
SELECT
setask.*,
setable.SecurityExceptionInfoID, setable.CatalogueType,
setable.CatalogueSubType, setable.EofE,
setable.UserWhoCreated, setable.EofEID,
NULL AS 'dummy1', NULL AS 'dummy2',
NULL AS 'dummy3', NULL AS 'dummy4'
FROM
SETask setask
INNER JOIN
SETable setable ON setask.SecurityExceptionID = setable.SecurityExceptionID
WHERE
setask.TechTeam = @techteam
ORDER BY
datecreated DESC
END
END
EXEC [setable_setask] 'Cloudteam'
This is what I tried
CREATE PROCEDURE count
@userTeam NVARCHAR(100),
@Count1 INT OUTPUT,
@Count2 INT OUTPUT
AS
BEGIN
EXEC [dbo].[setable_workflowtable] @techteam = @userTeam;
SELECT @Count1 = @@ROWCOUNT;
EXEC [dbo].[SecondProcedure] @techteam = @userteam;
SELECT @Count2 = @@ROWCOUNT;
END
I want my result to be like this
Pending4Approval | Pending4Implementation |
---|---|
10 | 0 |
1条答案
按热度按时间yrdbyhpb1#