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 the simplest way to create a new database in ms sql server?

1046


How to move database physical files in ms sql server?

1088


What are the elements of dbms?

1006


What is a transaction and why is it important?

1158


What is transaction server implicit?

1060


What is the default value of an integer data type in sql server 2005?

990


What are the difference between primary keys and foreign keys?

1010


explain what is a schema in sql server 2005? Explain how to create a new schema in a database? : Sql server database administration

998


Where the sql logs gets stored?

1030


How to delete a login name in ms sql server?

1115


what stored procedure would you use to view lock information? : Sql server administration

1016


What is the difference between osql and query analyzer?

1044


How to add a new dsn with the odbc driver for sql server?

1108


Why use update_statistics command in sql server?

1106


Explain logical operators in sql server?

1175