STORED PROCEDURE
CREATE PROCEDURE [dbo].[proc_Get_StateWiseParticipants]
--exec proc_Get_StateWiseParticipants 32
@FiscalYrId NUMERIC(5)
AS
DECLARE @Sql AS NVARCHAR(1000)
DECLARE @Cond AS NVARCHAR(500)
DECLARE @ParamDef AS NVARCHAR(300)
BEGIN
IF NOT @FiscalYrId=-1
SET @Cond=' AND FiscalYrId=@FiscalYrId'
ELSE
SET @Cond=''
SET @Sql='SELECT GradeName, SUM(Overseas)AS Overseas,SUM(InCountry) AS InCountry,SUM(InHouse)AS InHouse FROM VW_StateWiseparticipants WHERE 1<>2 '
SET @Sql=@Sql+@Cond +' GROUP BY GradeName'
SET @ParamDef='@FiscalYrId NUMERIC(5)'
EXECUTE SP_EXECUTESQL
@Sql,
@ParamDef,
@FiscalYrId
END
--exec proc_Get_StateWiseParticipants 32
@FiscalYrId NUMERIC(5)
AS
DECLARE @Sql AS NVARCHAR(1000)
DECLARE @Cond AS NVARCHAR(500)
DECLARE @ParamDef AS NVARCHAR(300)
BEGIN
IF NOT @FiscalYrId=-1
SET @Cond=' AND FiscalYrId=@FiscalYrId'
ELSE
SET @Cond=''
SET @Sql='SELECT GradeName, SUM(Overseas)AS Overseas,SUM(InCountry) AS InCountry,SUM(InHouse)AS InHouse FROM VW_StateWiseparticipants WHERE 1<>2 '
SET @Sql=@Sql+@Cond +' GROUP BY GradeName'
SET @ParamDef='@FiscalYrId NUMERIC(5)'
EXECUTE SP_EXECUTESQL
@Sql,
@ParamDef,
@FiscalYrId
END
vi vai aki kortasenn
ReplyDelete