这可能很简单,但我无法弄清楚如何用NOT NULL做一个简单的DateTime?
我想做这样的事情:
SELECT * FROM someTable WHERE thisDateTime IS NOT NULL
但这显然不起作用.如果这很重要,我正在使用MS SQL 2005.谢谢.
它确实有效吗?我刚测试过吗?
/****** Object: Table [dbo].[DateTest] Script Date: 09/26/2008 10:44:21 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[DateTest]( [Date1] [datetime] NULL, [Date2] [datetime] NOT NULL ) ON [PRIMARY] GO Insert into DateTest (Date1,Date2) VALUES (NULL,'1-Jan-2008') Insert into DateTest (Date1,Date2) VALUES ('1-Jan-2008','1-Jan-2008') Go SELECT * FROM DateTest WHERE Date1 is not NULL GO SELECT * FROM DateTest WHERE Date2 is not NULL