Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
Kaytee007
Starting Member
2 Posts |
Posted - 2014-04-04 : 18:58:16
|
The question I am stuck on is this !Create an INSERT trigger called tr_insert_shippers on the Shippers table preventing inserting a row with a company name which already exists. Use the following query to test your trigger.So far what i have done. I am very new to triggers and dont really have a clue what I am doing wrong. Help me out please ! CREATE TRIGGER tr_insert_shippersON ShippersFOR INSERTASDECLARE @Duplicate Varchar(20)IF EXISTS (SELECT CompanyName FROM Shippers WHERE CompanyName = @Duplicate)BEGINPRINT ('Duplicate Data' )ROLLBACK TRANSACTIONENDGO- |
|
|
|
|