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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 question regarding triggers in SQL SERVER 2005

Author  Topic 

raaj
Posting Yak Master

129 Posts

Posted - 2010-09-23 : 00:16:43
Hi Guys,
I am using SQL SERVER 2005.
I havent used any trigger till now in my job. So I am facing a slight problem in understanding and writing the code.....
I got the following requirement to create a new trigger for the following scenario :

The user (john) should be notified when the following happens :

Any transaction entered to account 100 which is not a ABN,CCH,or TTW
Any transaction entered to account 189 which is not a KHD

Description of fields :
100 and 189 are values for AccountCode Column in Account Table
ABN,CCH,TTW and KHD are values for CompanyTypeCode Column in Company Table.
I need to create new trigger on DLT_Data table

Here is the Sql I tried, but not able to understand how exactly to approach :

select A.AccountCode , A.AccountDesc, B.company_no,C.CompanyTypeCode,
from Account A
inner join DLT_Data B on A.acct_id = B.acct_id
inner join Company C on B.company_no= C.company_no
where A.AccountCode ='100'
and CompanyTypeCode NOT IN ('ABN', 'CCH','TTW')

Can anyone please help?????
I guess it will be for Insert and update

Thanks,
Raaj............

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-09-23 : 13:16:33
shouldnt this check be done at front end? i dont think its best to do this in a trigger

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -