@MemberType int, @Period int, @UnitNo int, @BranchUserId varchar(100), @FromDate datetime, @ToDate datetime AS BEGIN DECLARE @sql AS NVarchar(4000) SET @sql = 'select a.userid as [UserID],b.fullname as [Full Name],CONVERT(date,a.regdate,112) as [Joined Date],a.period as [Month Period],a.unitno as [UnitNo],b.address as [Address] from users a join profiles b on a.accountid=b.accountid where (1=1)' if @FromDate is not null set @sql = @sql + 'And a.regdate >= ' + @FromDate + '' if @ToDate is not null set @sql = @sql + 'And a.regdate <= ' + @ToDate + '' if @MemberType is not null set @sql = @sql + ' And a.membertype = ' + @MemberType if @Period is not null set @sql = @sql + ' And a.period = ' + @Period if @UnitNo is not null set @sql = @sql + ' And a.unitno = ' + @UnitNo if @BranchUserId is not null set @sql = @sql + ' And a.branchuserid = ' + @BranchUserId + '' EXEC(@sql) END
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)