Concatenate strings in SQL update statement ??

Results 1 to 2 of 2

Thread: Concatenate strings in SQL update statement ??

  1. #1
    Bruce D. Rempe Guest

    Default Concatenate strings in SQL update statement ??

    I have a database setup in SQL Server. Each record has a long-text fields that is called &#039activitylog&#039. Whenever some sort of change is made to the record, and coorisponding description needs to be added to the activity log.<BR><BR>How do I do this within an update statement?<BR><BR>I&#039d like to just issue: Update CustTable SET activitylog = "New activity Information" + activitylog WHERE custnum = 12323<BR><BR>Or something like that. But, this doesn&#039t work.<BR><BR>Thanks in advance for your help!<BR><BR>-bruce<BR>

  2. #2
    MG Guest

    Default RE: Concatenate strings in SQL update statement ??

    dim strSQL, strTemp, activitylog<BR><BR>activitylog = "whatever"<BR><BR>strSQL = "Select activitylog from CustTable Where custnum=12323"<BR><BR>Open Connection<BR>Open Recordset<BR><BR>If not Rec.EOF then<BR> strTemp = Rec("activitylog")<BR> strTemp = strTemp & " &#124 Date: " & Date() & " - " & activitylog<BR> Rec("activitylog") = strTemp<BR> Rec.Update<BR><BR> close recordset<BR> close connection<BR><BR>else<BR> response.write "no record found"<BR> close recordset<BR> close connection<BR>end if<BR><BR><BR>Have fun

Posting Permissions

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