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 |
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 TTWAny transaction entered to account 189 which is not a KHDDescription of fields :100 and 189 are values for AccountCode Column in Account TableABN,CCH,TTW and KHD are values for CompanyTypeCode Column in Company Table. I need to create new trigger on DLT_Data tableHere 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_nowhere 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 MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|
|