Automating Procedures to execute

  • I am trying to figure out if there is a way for me to write a script or something to that nature that will execute daily and look for accounts inside my database and the accounts that it finds that meet the criteria have it update some fields in these rows. I guess an example of this would be :

    Having a script that executes daily that will look at a date field inside one of my tables and compare it to the current date and get the number of days different and if the number of days is equal to some x # of days have it update certain fields on these rows that are x # of days old.

    If someone could provide me with some help or maybe just pointing me in the write the direction to where I would need to research that would be great.

    Thanks in advance for any help you can provide.

  • Hi,

    I will give you suggestion. Write a procedure and use cursor in that for check the accounts table according to your criteria and run this procedure in job schedule on daily routine. Read the BOL for procedures and cursors.

    Ramaa

  • I would agree on the job, but not on the cursor. From the sounds of things, the updates can be done set-based.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • You just schedule this proc to run every night using a SQL Agent Scheduled job... there's no better way than that.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply