请教存储过程变量在SELECT语句中的应用及参数传递问题
CREATE PROCEDURE kcel (@value3 date,@value4 date)
AS
begin
drop table chenping6
select 班级,姓名,任务 into chenping6 from (Select * From chenpingadd1 UNION Select
* From chenpingadd2 UNION Select * From chenpingadd3 UNION Select * From chenpingadd4
UNION Select * From chenpingadd5)nt where 结束时间 between '@vlaue3 ' and ' @value4 '
.......................................
_cursor */
close my_cursor
deallocate my_cursor
end
GO
这是一个存储过程里的部分内容,想用变量@vlaue3和@value4传递时间参数可是不行,请教为什么会不行能?还有在VB调用此过程时要命令要怎样写才能将参数传递进来?
[解决办法]
把引号去掉
where 结束时间 between @vlaue3 and @value4
[解决办法]
CREATE PROCEDURE kcel (@value3 date,@value4 date)
改為
CREATE PROCEDURE kcel (@value3 datetime,@value4 datetime)
where 结束时间 between '@vlaue3 ' and ' @value4 '
改為
where 结束时间 between @vlaue3 and @value4