Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

CREATE TABLE [dbo].[HPMS_CompetencyTypes](CompetencyType
varchar(50) )

go
create trigger hpms_create_Insert
on HPMS_CompetencyTypes
for insert
as
if Exists ( select * from [HPMS_CompetencyTypes] where
CompetencyType=(select * from [HPMS_CompetencyTypes]))
begin
Rollback tran
Raiserror ('duplicate value',12,6)
go
insert HPMS_CompetencyTypes (CompetencyType) values ('new')


I'm new to trigger can any one tell me where is the issue.
Please.

Answer Posted / mano karnan

pls try this now,

CREATE TABLE [dbo].[HPMS_CompetencyTypes](CompetencyType
varchar(50) )
go

create trigger hpms_create_Insert on HPMS_CompetencyTypes
for insert as
if Exists ( select * from [HPMS_CompetencyTypes] where
CompetencyType=(select * from [HPMS_CompetencyTypes]))
begin
Rollback tran
Raiserror ('duplicate value',12,6)
End
go
insert HPMS_CompetencyTypes (CompetencyType) values ('new')

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is repeatable read?

1021


What is normalization and its types?

1036


what is the difference between delete table and truncate table commands? : Sql server database administration

1036


What is the difference between online clustering and Offline clustering?

2419


what's the difference between delete table and truncate table commands? : Sql server database administration

983


Explain different types of self contained sub query?

1041


Explain system views?

1089


What are number line correlation administrators will use while working with a subquery?

1177


What is BCNF? How is it better than 2NF & 3NF?

1018


How to create a simple table to test triggers in ms sql server?

976


Name three of the features managed by the surface area configuration tool? : sql server security

992


What should be the fill factor for indexes created on tables? : sql server database administration

1139


Why Master database is required?

1145


Can binary strings be converted into numeric or float data types?

1037


What is the report builder?

139