select count(1) as 是否过期
from
(select filldate from cardfill
union all
select filldate from cardfilldate
union all
select indate from mainsavetable
) a
where filldate > getdate()--try
from
(select filldate from cardfill
union all
select filldate from cardfilldate
union all
select indate from mainsavetable
) a
where filldate > getdate()--try
from
(select filldate from cardfill
union all
select filldate from cardfilldate
union all
select indate from mainsavetable
) a
where filldate > getdate()
from
(
select filldate from cardfill
union all
select filldate from cardfilldate
union all
select indate from mainsavetable
) A
where filldate>getdate()
(select cnt=count(1) from cardfill where filldate > getdate()
union all
select count(1) from cardfilldate where filldate > getdate()
union all
select count(1) from mainsavetable where indate > getdate()
) t
CREATE FUNCTION CheckOutDay ()
Returns int
AS
Begin
declare @isout int
select @isout =count(1) from cardfill cf where cf.filldate > dbo.getdate()
if(@isout = 0)
select @isout = count(1) from cardfilldate cfd where cfd.filldate > dbo.getdate()
if(@isout = 0)
select @isout = count(1) from mainsavetable m where m.indate > dbo.getdate()
Return @isout
End
/******
这个完全没有问题,我测过了,不知道你,怎么不过!
******/CREATE FUNCTION CheckOutDay ()
Returns int
AS
Begin
declare @isout int
select @isout =count(1) from cardfill cf where cf.filldate > getdate()
if(@isout = 0)
select @isout = count(1) from cardfilldate cfd where cfd.filldate > getdate()
if(@isout = 0)
select @isout = count(1) from mainsavetable m where m.indate > getdate()
Return @isout
End
(select cnt=count(1) from cardfill where filldate > getdate()
union all
select count(1) from cardfilldate where filldate > getdate()
union all
select count(1) from mainsavetable where indate > getdate()
) t
大家动手快多了
sql2005中,函数内部可以用getdate()。
LZ是sql2000?
嗯,是sql 2000……貌似大家都用2005了……失败呀~
sql版的一帮老鸟都用sql2000,一样玩得出神入化