菜鸟求救,这个SQL要怎么写?
Select * From EMPLOYEE Where EMP_ID like [%EmpIDParm]
Parameters 写法如下:
Dim m_objADMIN_EmployeeMnt_EmployeeGetLikeEmpIDParms As BDParameters
Dim m_objEmpIDParm As BDParameter
Dim m_vtEmpIDParm As Variant
Set m_objEmpIDParm = m_objADMIN_EmployeeMnt_EmployeeGetLikeEmpIDParms.NewParameter( "EmpIDParm ", m_vtEmpIDParm)
上面是SQL的写法样式,都要写成上面的形式,
简单的查询还好些我现在有一个查询日期的条件如下:
预售日期: 从 A 到 B. 如果 A 有, B没有 则为 > A; 如果 B 有 A 没有, 则为 < B.
时间值是手工输入的
写成如上的形式高手给写个,谢谢。
------解决方案--------------------creare proc dbo.proc_getdata()
@a datetime,
@b datetime
as
set nocount on
if @a is null and @b is null return
if @a+@b> ' '
select * from table_pqs where a> @a and b <@b
else if @a is null
select * from table_pqs where a> @a
else if @b is null
select * from table_pqs where b <@b
go
------解决方案--------------------creare proc dbo.proc_getdata(
@a datetime,
@b datetime
)
as
set nocount on
if @a is null and @b is null return
if @a+@b> ' '
select * from table_pqs where a> @a and b <@b
else if @a is null
select * from table_pqs where a> @a
else if @b is null
select * from table_pqs where b <@b
go