October 24, 2005 at 10:06 am
October 24, 2005 at 10:09 am
where insert_date is null
October 24, 2005 at 10:21 am
Additional information about NULL:
http://www.sqlservercentral.com/columnists/mcoles/fourrulesfornulls.asp
No value can equal (=) null, Null is "Not Defined" or "Unknown"
IS NULL is the proper way to determine if a value is null.
October 25, 2005 at 1:43 am
If you want get just the date from GetDate() without the time, use CONVERT and the 112 format.
eg:
-- Get current date (without time) as string:
SELECT CONVERT( CHAR(8), GetDate(), 112)
-- Get current date (without time) as date:
SELECT CAST( CONVERT( CHAR(8), GetDate(), 112) AS DATETIME)
Julian Kuiters
juliankuiters.id.au
October 25, 2005 at 8:55 am
Francis, when using the CONVERT function, I suggest you always specify an appropriate length for varchar, i.e. SELECT CONVERT (varchar(11), getdate(), 106). Using varchar by itself is just shorthand for varchar(30). The advantage to using date format 112 as Julian suggested is that it will insert properly with all regional date settings (it will always work).
October 28, 2005 at 7:53 am
Thanks for your help the where insert date = null was a mistake.. in the code..
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply