单个选择语句中的多个参数 [英] Multiple Paramaters in a single select Statement
问题描述
您好我正在使用SQL Server 2008R2
i我正在尝试使用我将在项目中的表单上使用的多个参数编写查询。
参数
@Startdate
@EndDate
@Product
@Store
选择声明
选择*来自table1 where(date> = @startdate和Date< = @enddate)
和Product = @product and Store = @ Store
我遇到的问题是,如果其中一个参数值等于''或null,则不会返回任何数据。
请有人帮忙
Hi I am using SQL Server 2008R2
i am trying to write a query with multiple parameters that i will be using on a form in my project.
paramaters
@Startdate
@EndDate
@Product
@Store
Select Statement
Select * From table1 where (date >= @startdate and Date <= @enddate)
and Product = @product and Store=@Store
the problem i am having is if one of the parameters values equate to '' or null then no data will be returned.
Please could someone help
推荐答案
使用时间 ISNULL [ ^ ] - 链接包含示例
Time to use ISNULL[^] - the link includes examples
这篇关于单个选择语句中的多个参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!