Solved

micrsoft, sql server, databases, trigger insert help req'd

Posted on 2008-06-24
1
212 Views
Last Modified: 2008-07-03
folks

If i have one object called PO and another called
receipts with a relational field of po.ponum=receipts.ponum i.e.

PO table      
ponum      
1      
2      

Receipts      
ponum      item
1      100
2      101

how do i build a trigger to fire an insert into another
table (postatus)to show that there been made inserts made
into the receipts table based on the ponum  i.e.

postatus      
ponum      date
1      gedate
1      getdate


all help will do
0
Comment
Question by:rutgermons
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 2

Accepted Solution

by:
pierky earned 500 total points
ID: 21855301
That's the trigger: when you insert a new record in Receipts a new record is added to postatus too.
CREATE TRIGGER trReceiptsInsert ON dbo.Receipts 
FOR INSERT
AS
 
INSERT INTO postatus ( ponum, inserted )
SELECT
	ponum, GETDATE()
FROM
	inserted

Open in new window

0

Featured Post

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question