Solved

An Append Trigger

Posted on 2004-08-10
2
405 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
  • 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Nowadays, some of developer are too much worried about data. Who is using data, who is updating it etc. etc. Because, data is more costlier in term of money and information. So security of data is focusing concern in days. Lets' understand the Au…
Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

747 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now