Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Automatically delete data from a database [modified]

Automatically delete data from a database [modified]

Scheduled Pinned Locked Moved ASP.NET
databasetutorialhelpquestion
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    ASPnoob
    wrote on last edited by
    #1

    Hi everyone, Is there a way to automatically delete information from fields in a database after sometime has passed? For example if I want to delete a user's info from my database after he or she has been inactive for so long? Is there a setting in SQL 2005 that would let me do that or must I do it programmatically? Please explain the details of how to do this if you can or point me to a site that goes into details on this. Thank you in advance for your help.

    modified on Tuesday, April 29, 2008 10:31 PM

    C S 2 Replies Last reply
    0
    • A ASPnoob

      Hi everyone, Is there a way to automatically delete information from fields in a database after sometime has passed? For example if I want to delete a user's info from my database after he or she has been inactive for so long? Is there a setting in SQL 2005 that would let me do that or must I do it programmatically? Please explain the details of how to do this if you can or point me to a site that goes into details on this. Thank you in advance for your help.

      modified on Tuesday, April 29, 2008 10:31 PM

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      No, you can't do that. You can store a date stamp on a record, and the next time the DB is accessed, delete it as having timed out.

      Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

      A 2 Replies Last reply
      0
      • C Christian Graus

        No, you can't do that. You can store a date stamp on a record, and the next time the DB is accessed, delete it as having timed out.

        Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

        A Offline
        A Offline
        ASPnoob
        wrote on last edited by
        #3

        Hi there Christian, I haven't bugged you in a while. So are saying that I can not automatically delete data from a SQL database through code and instead would have to delete it manually? If I write a function to access the database to make it search for the datetime field that has reached a preset time, then tell it to delete all info in the same row as the datetime, I think it would be possible to what I intended. The only problem is the function would have to be triggered by something outside of the database if the database can't communicate with the function. What is your opinion on that? Please give a better solution if you can think of one. Thanks in advance for your time.

        C 1 Reply Last reply
        0
        • C Christian Graus

          No, you can't do that. You can store a date stamp on a record, and the next time the DB is accessed, delete it as having timed out.

          Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

          A Offline
          A Offline
          ASPnoob
          wrote on last edited by
          #4

          Hi there Christian, I haven't bugged you in a while. So you are saying that I can not automatically delete data from a SQL database through code and instead would have to delete it manually? If I write a function to access the database to make it search for the datetime field that has reached a time limit, then tell it to delete all info in the same row as the datetime, I think it would be possible to what I intended. The only problem is the function would have to be triggered by something outside of the database if the database can't communicate with the function. What is your opinion on that? Please give a better solution if you can think of one. Thanks in advance for your time.

          modified on Wednesday, April 30, 2008 12:14 AM

          1 Reply Last reply
          0
          • A ASPnoob

            Hi there Christian, I haven't bugged you in a while. So are saying that I can not automatically delete data from a SQL database through code and instead would have to delete it manually? If I write a function to access the database to make it search for the datetime field that has reached a preset time, then tell it to delete all info in the same row as the datetime, I think it would be possible to what I intended. The only problem is the function would have to be triggered by something outside of the database if the database can't communicate with the function. What is your opinion on that? Please give a better solution if you can think of one. Thanks in advance for your time.

            C Offline
            C Offline
            Christian Graus
            wrote on last edited by
            #5

            The main thing is, your DB won't do anything on it's own. You can write a service that calls the DB to delete timed out records, but the record doesn't matter until your next request anyhow, right ? So, just time stamp them and delete them before reading data from that table again.

            Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

            1 Reply Last reply
            0
            • A ASPnoob

              Hi everyone, Is there a way to automatically delete information from fields in a database after sometime has passed? For example if I want to delete a user's info from my database after he or she has been inactive for so long? Is there a setting in SQL 2005 that would let me do that or must I do it programmatically? Please explain the details of how to do this if you can or point me to a site that goes into details on this. Thank you in advance for your help.

              modified on Tuesday, April 29, 2008 10:31 PM

              S Offline
              S Offline
              samMaster
              wrote on last edited by
              #6

              Hi, I think you can do that using scheduler on sql server 2005. This may be help you: http://www.microsoft.com/technet/prodtechnol/sql/2005/newsqlagent.mspx[^]

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups