Solved

An Append Trigger

Posted on 2004-08-10
2
413 Views
Last Modified: 2006-11-17
I need to create a trigger that appends "-ABCD" to a field where "-ABCD" doesn't already exist at the end of the field.  


  Can anyone help??

Thanks,
  MysticalFever
0
Comment
Question by:mysticalfever
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 14

Accepted Solution

by:
Thandava Vallepalli earned 100 total points
ID: 11762584
Hi here is your trigger



CREATE TRIGGER trigger_name ON employee
FOR INSERT, UPDATE
AS
      
declare @x varchar(200)
      SELECT @x=lname FROM inserted
      IF not (@x like '%-ABCD')
      begin
            update employee set lname = '%-ABCD'
            where emp_id = (select emp_id from inserted)
      end

GO


itsvtk
0
 
LVL 14

Expert Comment

by:Thandava Vallepalli
ID: 12338674
0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question