September 23, 2010 at 3:07 am
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
September 23, 2010 at 3:35 am
grkanth81 (9/23/2010)
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
Here you want to insert data into DLT_Data table. How it would help to notify the user(john) as trigger will only use to work on DML operations ?.
and can you post the complete trigger script ?
-------Bhuvnesh----------
I work only to learn Sql Server...though my company pays me for getting their stuff done;-)
September 23, 2010 at 3:41 am
This was removed by the editor as SPAM
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply