Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

SQL Trigger based solution

$
0
0

Hi ALL ,

I have Tables -

Organization table with Columns :organizationid & OrganizationName .

Customer table with with Columns :CustomerID , CustomerName & AreaID

My Requirement is too trigger an insert and send email from the triggers based on the following conditions. If a new Organization is inserted into the Organization table and if its a unique one in that table then compare the name with the Customer table Customer Name Column .

If the Organization Name is not present even there insert it into Customer Table .

--The Customer ID will be the increment of the previous id in it so suppose the previous ID was 45 new one will be 46 likewise for every new insertion .

--CustomerName field will be populated with the Name of the Organization that was not found in both the tables .

--AreaID :  Will be populated with a default value of 8 .

--An email should also be sent about the newly added Customers to the Customer table .

Am very new to T SQL based development kindly help .

Thanks in Advance

Priya


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>