Hiya,
I am a complete newbie at this, but I am a programmer. I simply cannot understand what I am doing wrong and I am hoping that one of you can sort me out very quickly.
I have a date on a table called History in a 10 character varchar field called date (I know, I know, poor design - not my doing I hasten to add!). I need to delete all rows from that table over 7 days old. I am trying to use this code:
/Code
DECLARE @MyDate DateTime
Delete History
Where
(SELECT (CONVERT (char(10), (substring date],1,10)), 101)) As @MyDate
Where @MyDate < (GetDate() -7)
/Code
I am getting all sorts of syntax errors here - any help gratefully received!
I am a complete newbie at this, but I am a programmer. I simply cannot understand what I am doing wrong and I am hoping that one of you can sort me out very quickly.
I have a date on a table called History in a 10 character varchar field called date (I know, I know, poor design - not my doing I hasten to add!). I need to delete all rows from that table over 7 days old. I am trying to use this code:
/Code
DECLARE @MyDate DateTime
Delete History
Where
(SELECT (CONVERT (char(10), (substring date],1,10)), 101)) As @MyDate
Where @MyDate < (GetDate() -7)
/Code
I am getting all sorts of syntax errors here - any help gratefully received!