| Author |
Topic |
|
mlawton40
Starting Member
15 Posts |
Posted - 2008-07-13 : 07:26:54
|
| Hey, does anyone know what is wrong with the following:DELETE FROM Courses WHERE ExpiryDate IS NOT '01/01/1900 00:00:00' AND ExpiryDate < GETDATE()Does anyone know what would work?Thanks, Mark |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2008-07-13 : 08:03:16
|
[code]DELETE FROM Courses WHERE ExpiryDate <> '01/01/1900 00:00:00' AND ExpiryDate < GETDATE()[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
DavidChel
Constraint Violating Yak Guru
474 Posts |
Posted - 2008-07-14 : 10:28:34
|
| Isn't that redundant anyway? If the date is '01/01/1900 00:00:00', isn't it then also less than today's date? |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-07-14 : 10:30:21
|
Perhaps in his system, a date of '1/1/1900' means the same as NULL for the rest of us (ie No valid date or unknown date)? E 12°55'05.25"N 56°04'39.16" |
 |
|
|
DavidChel
Constraint Violating Yak Guru
474 Posts |
Posted - 2008-07-14 : 10:32:05
|
quote: Originally posted by Peso Perhaps in his system, a date of '1/1/1900' means the same as NULL for the rest of us (ie No valid date or unknown date)? E 12°55'05.25"N 56°04'39.16"
Yes, it does the same thing in my ERP system, but I was asking if that would work. If the system by default enters 1900 it should work in that query anyway, right? |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-07-14 : 10:36:55
|
No. If only "ExpiryDate < GETDATE()" is present, all dates with value "1/1/1900" are deleted too.I think OP want records with value "1/1/1900" to remain in the database. E 12°55'05.25"N 56°04'39.16" |
 |
|
|
mfemenel
Professor Frink
1421 Posts |
Posted - 2008-07-14 : 10:49:24
|
| Why not use between DELETE FROM Courses WHERE ExpiryDate between '01/02/1900 00:00:00' AND GETDATE()-1Mike"oh, that monkey is going to pay" |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-07-14 : 10:52:51
|
Who knows?Maybe there are more "special" date values, such as "12/31/1899" OP wants removed? E 12°55'05.25"N 56°04'39.16" |
 |
|
|
DavidChel
Constraint Violating Yak Guru
474 Posts |
Posted - 2008-07-14 : 10:53:48
|
quote: Originally posted by Peso No. If only "ExpiryDate < GETDATE()" is present, all dates with value "1/1/1900" are deleted too.I think OP want records with value "1/1/1900" to remain in the database. E 12°55'05.25"N 56°04'39.16"
You are of course right Peso, I don't think I got enough sleep last night. I missed that. |
 |
|
|
|