表icaption如下:
CREATE TABLE [dbo].[icaption] (
[capid] [bigint] IDENTITY (1, 1) NOT NULL ,
[caption] [nvarchar] (300) COLLATE Chinese_PRC_CI_AS NOT NULL ,
[enddate] [smalldatetime] NOT NULL
) ON [PRIMARY]
GO
存储过程如下(删除icaption表中enddate等于当前日期的数据):
CREATE procedure updateanddel
@ld_nowdate datetime
as
begin
delete from icaption where enddate = @ld_nowdate
end
GO
数据表里数据如下:
1 欢迎光临度假圣地 2012-05-22 08:22:00
pb代码:
time lt_nowtime
date ld_nowdate
ld_nowdate = date(string(today() ,'yyyy-mm-dd'))
declare sp_updateanddel procedure for updateanddel
@ld_nowdate = :ld_nowdate;
execute sp_updateanddel ;
commit;
执行后删除不了icaption表中的数据,请问是哪里的原因?谢谢!
------解决方案--------------------
- SQL code
CREATE procedure updateanddel @ld_nowdate datetimeas begin delete from icaption where enddate between @ld_nowdate +' 00:00:00' and @ld_nowdate +' 23:59:59'endGO