asp.net - Stored procedure takes too much time in if statement when i pass @ip='' and takes 0 sec with some value to @IP -
i have below sp , taking time , stopped exec memberlisting 1,20,'','','regdate','desc',0 while works if pass value @ip parameter. don't know why. create procedure memberlisting @pagenum int, @perpageresult int, @username nvarchar(50), @ip varchar(50), @sortcolumn varchar(50), @sortorder varchar(4), @totalcount int output begin declare @temp table(rownum int, id bigint, username nvarchar(50), email nvarchar(50), regdate datetime, country varchar(25), lastlogin datetime, isgoldmember varchar(1)) declare @sort varchar(50) if @ip = '' begin print 'if' set fmtonly off; insert @temp select row_number() on (order case when @sortorder <> 'asc' 0 when @sortcolumn = 'id' id end asc , case when @sortorder <> 'asc' 0 when @sortcolumn = 'username...