Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2003
    Location
    California
    Posts
    40

    Unanswered: Automatic insert with a variable

    Hi everyone, I'm very new at SQL so my knowledge is very limited. Therefore, all the details/examples I need to know to accomplish this would be greatly appreciated. Anyway, I was wondering if there was a way to create a job (that will run every week) that inserts a record into a database...which I've figured out how to do using the "Job" area in SQL EM, in fact, here's what I have -

    INSERT INTO ProjMan (CustID, EntryDate, DueDate, DueTime, EmpEntered, Tech, ProjDesc, ProjType, Notes, IsCompleted) Values (1, '12/10/03', '1/2/04', '1/2/04 10:00:00 AM', 'Jamie', 'Jamie', 'Lito Report - auto insert','Job', 'no notes', 0)

    But as you can see, my dates (and time) is 'hard-coded' in there. So my question is this: is there a way to automatically grab the current day and use it? Better yet, I would like this job to run every Sunday and actually have the date be for the coming up Tuesday, so i would need to add 2 days to the variable also if possible. If this isn't possible, I can just have the job run early Tuesday morning and insert it as the current day.

    Thanks in advance for the help.

  2. #2
    Join Date
    Jul 2002
    Location
    Village, MD
    Posts
    621
    Check BOL for functions getdate(), dateadd(), datepart(), etc.

  3. #3
    Join Date
    Dec 2003
    Location
    California
    Posts
    40
    Thanks alot. I'll check it out.

Posting Permissions

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