this my store procedure
i want to stored count values in columns
create procedure usp_GetPKPopulationDetails
(
@Id int,
@PK_Total_Population nvarchar(max)
,@PK_Total_Male nvarchar(max)
,@PK_Total_Female nvarchar(max)
,@PK_Total_Male_Married nvarchar(max)
,@PK_Total_Female_Married nvarchar(max)
,@PK_Total_Male_Single nvarchar(max)
,@PK_Total_Female_Single nvarchar(max)
,@PK_Total_Dead nvarchar(max)
,@PK_Total_Male_Dead nvarchar(max)
,@PK_Total_Female_Dead nvarchar(max)
,@Month date
)
as
begin
INSERT INTO [dbo].[tbl_PK_Population]
([PK_Total_Population]
,[PK_Total_Male]
,[PK_Total_Female]
,[PK_Total_Male_Married]
,[PK_Total_Female_Married]
,[PK_Total_Male_Single]
,[PK_Total_Female_Single]
,[PK_Total_Dead]
,[PK_Total_Male_Dead]
,[PK_Total_Female_Dead]
,[Month])
VALUES
(@PK_Total_Population select count(*) from tbl_Vill_Members where activeId=1
,@PK_Total_Male select count(*) from tbl_Vill_Members where genderid=1
,@PK_Total_Female
,@PK_Total_Male_Married
,@PK_Total_Female_Married
,@PK_Total_Male_Single
,@PK_Total_Female_Single
,@PK_Total_Dead
,@PK_Total_Male_Dead
,@PK_Total_Female_Dead
,getdate())
end
What I have tried:
this my store procedure
create procedure usp_GetPKPopulationDetails
(
@Id int,
@PK_Total_Population nvarchar(max)
,@PK_Total_Male nvarchar(max)
,@PK_Total_Female nvarchar(max)
,@PK_Total_Male_Married nvarchar(max)
,@PK_Total_Female_Married nvarchar(max)
,@PK_Total_Male_Single nvarchar(max)
,@PK_Total_Female_Single nvarchar(max)
,@PK_Total_Dead nvarchar(max)
,@PK_Total_Male_Dead nvarchar(max)
,@PK_Total_Female_Dead nvarchar(max)
,@Month date
)
as
begin
INSERT INTO [dbo].[tbl_PK_Population]
([PK_Total_Population]
,[PK_Total_Male]
,[PK_Total_Female]
,[PK_Total_Male_Married]
,[PK_Total_Female_Married]
,[PK_Total_Male_Single]
,[PK_Total_Female_Single]
,[PK_Total_Dead]
,[PK_Total_Male_Dead]
,[PK_Total_Female_Dead]
,[Month])
VALUES
(@PK_Total_Population select count(*) from tbl_Vill_Members where activeId=1
,@PK_Total_Male select count(*) from tbl_Vill_Members where genderid=1
,@PK_Total_Female
,@PK_Total_Male_Married
,@PK_Total_Female_Married
,@PK_Total_Male_Single
,@PK_Total_Female_Single
,@PK_Total_Dead
,@PK_Total_Male_Dead
,@PK_Total_Female_Dead
,getdate())
end