Results 1 to 26 of 26

Thread: [RESOLVED] Update record on SQL

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2006
    Posts
    97

    Resolved [RESOLVED] Update record on SQL

    I am using MS SQL SERVER 2000 with a PERL SCRIPT.

    Code:
    UPDATE [CustSat].Customers_T
    	SET [CustSat].[Customers_T].LastEmailSent = GETDATE(),[CustSat].[Customers_T].LastTicketSent = TicketAssignment_T.TicketNumber
    	SELECT TOP $survey_total TicketAssignment_T.Customer_ID, TicketNumber, LanID, EmailAddress, ShortDescription
    	FROM TicketAssignment_T
    	INNER JOIN Customers_T
    	ON (TicketAssignment_T.Customer_ID = Customers_T.Customer_ID)
    	WHERE((DATEDIFF(day,Customers_T.LastEmailSent, GETDATE()) > $customer_days) OR (Customers_T.LastTicketSent IS NULL))
    	ORDER BY NEWID()
    Where ever you see a $ is a variable from a perl script.


    Anyways, what the code is supposed to do is just update the TOP #, which are selected randomly by used ORDER BY NEWID(), and update those values with the current date. Instead, it is updating every row in the table with the current date. How could I change this?
    Last edited by mlosso; Jul 10th, 2006 at 07:51 AM.

Posting Permissions

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



Click Here to Expand Forum to Full Width