Home Forums SQL Server 2008 T-SQL (SS2K8) Loop Through the records - send email - set the value of the field - Need Code Help RE: Loop Through the records - send email - set the value of the field - Need Code Help

  • skb 44459 (10/19/2012)


    Thanks for the reply.

    Another Quick Question. My Email body is very long.

    Ideally i would like to store the Body in a text file and read the text file into a SQL Variable like

    set @EmailBody = 'read from the text file

    Is it possible ?

    of course;

    it's just a separate select statement:

    SELECT @EmailBody = EmailTemplate

    FROM Campaigns WHERE templateID = 42

    --assuming there are customized fields for find and replace?

    SET @EmailBody = REPLACE(@EmailBody, '[firstnamePlaceholder', @FirstNameFromCursor;

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!