Professional Web Applications Themes

delete automatic in table after 2 months - Coldfusion Database Access

I need to delete automatic in DB after 2 months. db tbl in_sert column recordID employeeID datum (date) mfm mem tfm tem ofm oem recordID = counter employeeID = number date = date/time mfm = text <cfquery datasource="palett" name="anyName"> delete how to define this: // check if there is any old more than 2 months will delete, currentNow - oldtwomonth </cfquery>...

  1. #1

    Default delete automatic in table after 2 months

    I need to delete automatic in DB after 2 months.

    db tbl in_sert
    column recordID employeeID datum (date) mfm mem tfm tem ofm oem

    recordID = counter
    employeeID = number
    date = date/time
    mfm = text

    <cfquery datasource="palett" name="anyName">
    delete

    how to define this:
    // check if there is any old more than 2 months will delete, currentNow -
    oldtwomonth

    </cfquery>

    pilem17 Guest

  2. #2

    Default Re: delete automatic in table after 2 months

    if you are running SQL server
    do this

    delete in_sert
    where datediff(mm,[date],getdate() >=2

    I assumed date is the date column name since it's a keyword I put brackets
    around it

    A better way is to create a procedure with this code and have a scheduled job
    call this procedure daily



    SQLMenace Guest

  3. #3

    Default Re: delete automatic in table after 2 months

    Drive in access and get wrong message.

    DELETE FROM in_sert
    WHERE dateDiff (dd,datum,getdate())> 60

    [Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft
    Access Driver] Undefined function &apos;getdate&apos; in expression.



    pilem17 Guest

  4. #4

    Default Re: delete automatic in table after 2 months

    delete [column]
    FROM [table]
    WHERE dateDiff ("d",[date],now())>60;

    wrong message:
    [Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft
    Access Driver] Too few parameters. Expected 1.
    original code:
    Delete datum FROM in_sert WHERE dateDiff ("d",datum,now())>60;



    pilem17 Guest

Similar Threads

  1. Delete form - Post data to a table and delete uponsubmit.
    By FusionRed in forum Coldfusion - Getting Started
    Replies: 3
    Last Post: July 28th, 01:27 PM
  2. PHP/MySQL Delete Row...Automatic Shift Numbers Down?
    By Merlin in forum PHP Development
    Replies: 6
    Last Post: June 12th, 04:18 PM
  3. Delete key doesn't delete when datagrid is bound to a disconnected table
    By Fred Zolar in forum ASP.NET Data Grid Control
    Replies: 0
    Last Post: April 1st, 07:47 AM
  4. Table listing of months
    By Ashley M. Kirchner in forum PHP Development
    Replies: 0
    Last Post: August 9th, 09:21 PM
  5. Delete from one table with matching records in another table
    By Dale Fye in forum Microsoft SQL / MS SQL Server
    Replies: 4
    Last Post: July 1st, 01:28 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139