SQL Server 7 Triggers...

Results 1 to 2 of 2

Thread: SQL Server 7 Triggers...

  1. #1
    Join Date
    Dec 1969

    Default SQL Server 7 Triggers...

    Call me rusty as heck, but I cannot remember this and can&#039;t find a reference on SQL Server Books Online.<BR><BR>I have a field with a description record on it. Whenever the record is saved (inserted or updated), I want to take this name field, remove all characters except A-Z (including spaces) render it uppercase and then put it on a "search me" field in the same record.<BR><BR>I can figure out the stringing stuff, I think. What is driving me crazy is -- HOW ON EARTH DO I PUT THE CHANGED FIELD INTO THE RECORD!!!!!<BR><BR>I am stumped, and as soon as I finish posting I will go call the doctor for some Aricept or other memory meds.<BR><BR>Thanks<BR>John

  2. #2
    Join Date
    Dec 1969

    Default RE: SQL Server 7 Triggers...

    CREATE TRIGGER tr_description_UPDINS ON DescriptionTable<BR>FOR UPDATE, INSERT<BR><BR>AS<BR><BR>IF Update(Description)<BR>BEGIN<BR> UPDATE DescriptionTable<BR> SET SearchMe = UCASE(I.Description)<BR> FROM DescriptionTable D<BR> INNER JOIN Inserted I ON D.[PrimaryKey] = I.[PrimaryKey]<BR>END<BR><BR>Of course this only works for the Upper case, but just add the other string functions.<BR>Replace [PrimaryKey] with the ID field of the record.<BR>

Posting Permissions

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