如果销售日期已过期或尚未激活,但仅当assignDate为true,才想将saletype设置为0。我如何在视图中构建它?如果在Sql Server视图中声明
SELECT dbo.ItemStore.SaleType, dbo.ItemStore.SpecialBuyFromDate AS SaleStartDate ,
dbo.ItemStore.SpecialBuyToDate AS SaleEndDate , dbo.ItemStore.AssignDate
FROM dbo.ItemMainAndStoreView
有趣的使用DATEADD(day,0,DATEDIFF(day,0,GETDATE()))来获取当天的开始 – lambacck 2011-06-02 18:53:02
@lambacck:最有效的方法来做到这一点http://stackoverflow.com/questions/1177449/最好的方法去除的时间,部分的,日期时间,在-SQL服务器/ 1177529#1177529 – gbn 2011-06-02 18:55:07