C#技术百科
问问你的心你有没有信心 做事情要专一坚定,执着

AND (ISNULL(@DateType,-1)=-1 or (@DateType=1 AND ((ISNULL(@StartDate,'')='01  1 1900 12:00AM' OR A.CreateDate>=@StartDate+' 00:00:00' ) AND (ISNULL(@EndDate,'')='01  1 1900 12:00AM' OR A.CreateDate<=@EndDate +'23:59:59')))
or (@DateType=2 AND ((ISNULL(@StartDate,'')='01  1 1900 12:00AM' OR A.SolveDate>=@StartDate+' 00:00:00' ) AND (ISNULL(@EndDate,'')='01  1 1900 12:00AM' OR A.SolveDate<=@EndDate +'23:59:59')))
or (@DateType=3 AND ((ISNULL(@StartDate,'')='01  1 1900 12:00AM' OR A.CloseDate>=@StartDate+' 00:00:00' ) AND (ISNULL(@EndDate,'')='01  1 1900 12:00AM' OR A.CloseDate<=@EndDate +'23:59:59')))
)

 

sql多条件检索

and (ISNULL(@DateType,-1)=-1 or (@DateType=1 or createdate>@startDate))

posted on 2011-07-21 10:15  王德田  阅读(299)  评论(0编辑  收藏  举报