Trigger On View--is It Possible Or I Missing Something

Apr 22, 2005

hi...

is it possible to create a trigger on view object....

usually we divide our table in to a smaller pieces and use view to get the big picture of it..

my task is to record any/every select statement on each table.. so logically we create view and is it possible to use trigger(to record the accesses) in view..

please help..

or just give me a link to get that info..
tnx

View 2 Replies


ADVERTISEMENT

Bcp And Trigger: Missing Data In Bcp Out File

Jan 31, 2007

I have made trigger on table 'FER' that would be fired if data isinserted, updated to the table. And also, I made batch file using bcpto extract the newly updated / inserted records.But I got missing data in bcp out file like this:Missing 1200 records, blocked at:/*777946 296188 2007-01-29 21:25:45.063778145 296494 2007-01-29 21:25:47.063*/1. trigger.sqlCREATE TABLE [FERUpdate] ([id] [int] NOT NULL ,[fid] [int] NOT NULL ,[sid] [int] NOT NULL ,[UpdatePass] [int] NULL) ON [PRIMARY]GOcreate trigger trgFERUpdate on FER For Insert,Update asinsert into FERUpdate(id,fid,sid) select ins.id, ins.fid,ins.sid frominserted ins2. bcp.bat----isql -U <user-P <pw-S server -Q "update AA..FERUpdate setUpdatePass=1 where UpdatePass is null"bcp "select a.* from AA..FER a, AA..FERUpdate b where a.fid=b.fid anda.sid=b.sid and b.fid<>-1 and b.sid<>-1 and b.updatepass=1" queryout%TFN_NOW%.wrk -U <user-P <pw-S server -f FER.fmtisql -U <user-P <pw-S server -Q "delete from AA..FERUpdate whereUpdatePass=1"-----I have been struggling with this for these two days. Your any helpsare appreciated, Please help me out!! Thanks!!!

View 2 Replies View Related

Missing Data Set When Trying To View For A Finished Report

Mar 6, 2008



Hi All,
I have a solution which is synchronised with visualsourcesafe. Now there are some reports present in the solution, I am able to view the preview of the reports but when I am going to view the dataset definition It is not able to retain its defintion and its becoming blank but this happens to only datasets which were developed from cube and its able to retain dataset which are developed from Database.

Any help would be of great use.

Thanks in advance
Regards

View 1 Replies View Related

Data Source View Missing Fields

May 9, 2008

Is there a limit on the number of fields that can be displayed in a table object in a data source view in SSAS 05?
One of the tables (the fact table) in my data source view is displaying only 50 fields. The table actually has many more than that. One of the fields that is not displaying is a foreign key that I need to link to a new dimension table. I have tried refreshing the view, but it doesn't bring in any additional fields.



View 10 Replies View Related

Missing Images In Rendered HTML View

Feb 9, 2007

Hi,

i have a report with an image on the footer. When i view the report in the designer/report manager or export to any format, everythings fine. Now i have a ASP.NET site which makes a webservice call to get HTML output from my report. in this case no image show up. The Url of the image is like that: h**p://servername/ReportServer?%2fDocuments%2fGerman%2fOrder%2fOrderResponse&rs%3aFormat=HTML4.0&rs%3aImageID=ac8c4a8c-8a63-4ff9-ba74-6d6a7076a0ef

When i check the HTML version of the Report Manager the url of the image is like: h**p://servername/Reports/Reserved.ReportViewerWebControl.axd?ReportSession=iuwsgfikvz4ezfmd0tqmyj45&ControlID=cee4d933-5ab6-413f-8c28-4c3a2b3ff230&Culture=1031&UICulture=7&ReportStack=1&OpType=ReportImage&StreamID=84e7491d-eab4-4502-adac-2bec4254da90

I take the byte stream of the report from the RS Service an put it to the HttpResponse of the ASP.NET page.

What could be the problem?

View 3 Replies View Related

View, SP, & Trigger Reference

Nov 2, 1998

Can anyone recommend a good reference book on views, stored procedures (system stored
procedures as well) and triggers? I am in need of assistance in these areas.

Thanks!
Toni

View 2 Replies View Related

Problem Trigger/View

Sep 24, 2005

I got a view that gest information från a certain table. Then i got a trigger that should copy new information from this view to a specific table. How should this trigger know when new information has been inserted in the View?

CREATE TRIGGER copyRow
ON person_View
INSTEAD OF INSERT
AS
BEGIN
INSERT into kontakt (nr, telefon, adress)
values ('2', '3', '4')
commit transaction
END

View 7 Replies View Related

Trigger View/Edit

May 21, 2008

Hi all!

How do u view the triggers in sql 2000 qry analyzer. I know you can use sp_helptrigger-- which will give the list of triggers-- -- But, I need to be able to run command from qry analyze and see the script used to create triggers
Having limited access to the design tables-- wont be able to see trigger from sql design table


Thank you


Josephine

View 2 Replies View Related

Trigger On System View

Mar 24, 2006

Hi,

Is there a way to create a Trigger on the Systemview [sys].[dm_exec_connections] ?

The Statement below Fails.

CREATE TRIGGER [dbo].[TG_CLEAN_LOCK_ID] ON [sys].[dm_exec_connections]

AFTER DELETE

AS

I need a trigger to be fired when a Connection ([sys].[dm_exec_connections] .[connection_id]) drops.

Is it principally impossible to create a trigger on a system view or is it just a lack on permissions making my SQL fail?

Is there any other way for surveying wether a connection is alive or not, without polling?

Thanks in advance

Raimund





View 3 Replies View Related

Create Trigger For View

May 22, 2006

Hi,

just started to write my first trigger for a view. Of course I got some errors, which I could could resolve except one.
Whenever I run my script I do get the following message:


Msg 213, Level 16, State 1, Procedure IO_Trig_INS_Zuordnung_Alles, Line 11
Insert Error: Column name or number of supplied values does not match table definition.

The Code where the error occurs according that message is the following:

CREATE TRIGGER IO_Trig_INS_Zuordnung_Alles ON Zuordnung_Alles
INSTEAD OF INSERT
AS
BEGIN
SET NOCOUNT ON
-- Check for duplicate Zuordnung. If there is no duplicate, do an insert.
IF (NOT EXISTS (SELECT Z.[Anlagen-Nr_Z]

FROM Zuordnung Z, inserted I
WHERE Z.[Anlagen-Nr_Z] = I.[Anlagen-Nr_Z]))
INSERT INTO Zuordnung
SELECT [Anlagen-Nr_Z], [I-Nr], [an_A-Nr], [APS-Reg], [KSt des Inventars], [Gelände_Raum], [Servicenummer], [S-Nummer], [Hostname], [LOGIN-Name], [Mitarbeiter von], [Kategorie], [Verwendung], [Hersteller und Typ], [Ausstattung], [F-Nr], [Board], [Bios], [Prozessor], [Cache], [RAM], [SCSI-Contr], [CD-Rom], [Festplatten], [Wechselplatten], [Sonderausstattung], [Graphik], [Sound], [MPI], [NW-Karte], [MAC-Adr], [DHCP], [IP-Adr], [Netz], [Port], [Segment_ID], [NAP], [NW-Karte_2], [MAC-Adr_2], [DHCP_2], [IP-Adr_2], [Netz_2], [Port_2], [Segment_ID_2], [NAP_2], [Bemerkungen], [Betriebssysteme], [Dual-Boot], [geplante Maßnahmen], [Servicearbeiten], [aktualisiert], [wieder frei], [zurück von], [COB-Kostentyp], [COB-Import], [Dummy3], [Dummy4], [Inventursuche
FROM inserted
ELSE...

I did check on the columns serveral times, also I wrote them back with vba and used that but nothing helps. I would appreciate any help on possible errors in that code.

View 9 Replies View Related

DB Design :: View Or Trigger

Jun 10, 2015

i have a question about updating views:for example: lets assume we have a table which keep the users score and we have a view which created from so many tables and calculate the sum of the users scores. now if one of the user's score changes all the view created again or just part of the view will update?i ask this to find out how can i design my database? how can calculate users scores?i can wrote a trigger to do it or use the view. which way is faster and better in this case?

View 9 Replies View Related

Create Trigger On View Failed

Aug 12, 2005

I want to create a trigger on a view for insert, but I got a message said 'Invalid object name'. I can select from this view. Followings are my scripts and error message:
(run on SQL 2000)
create table t1 (c1 char (10) NULL )
create view vt as select * from t1
create table log1 (c1 datetime NULL )

create trigger tr1 ON t1
for insert
AS
insert into log1 values (getdate())
----------all above succeed
create trigger tr2 ON vt
for insert
AS
insert into log1 values (getdate())

Server: Msg 208, Level 16, State 4, Procedure tr1, Line 1
Invalid object name 'vt'.

Thanks!

Theresa

View 2 Replies View Related

Problem Creating TRIGGER On A VIEW

Feb 11, 2004

Hello,

I have a problem that definitely has me stumped.

I have a view that looks at data in a different database. Some of the fields in the view are updateable and some are not. I am trying to create a trigger against the view that will allow me to audit the updates into an audit table. I am having problems when trying to execute the CREATE TRIGGER statement.

I keep getting the message...

Server: Msg 208, Level 16, State 4, Procedure updDocInfo, Line 1
Invalid object name 'vwDC_DocInfo'.

Where vwDC_DocInfo is the name of the view.

Does anyone have any idea why I might be getting this error? The VIEW definitely does exist and I am executing the script in the same database as the view.

The script is included below...


CREATE TRIGGER updDocInfo
ON [vwDC_DocInfo]
FOR UPDATE AS

DECLARE @ModifiedDate AS DATETIME
SELECT @ModifiedDate = GETDATE()

-- Audit OLD record.
INSERT tblAudit_DC_DocInfo
SELECT
0 AS AuditType,
ItemID,
Comment,
VersionComment,
CheckedOut,
Title,
BaseParagonDocumentNumber,
Author,
ClientDocumentNumber,
ClientDocumentType,
ClientJobNumber,
[Module],
Unit,
SequenceNumber,
RevisionDate,
ApprovedBy,
CheckedDepartmentManager,
CheckedLeadEngineerDesigner,
IssueType,
RevisedByDesigner,
RevisedByEngineer,
RevisionCode,
HSECheck,
CurrentVersionNumber,
CurrentVersionDate,
USER AS ChangedByUser,
@ModifiedDate AS DateChanged
FROM DELETED DEL


-- Audit NEW record.
INSERT tblAudit_DC_DocInfo
SELECT
0 AS AuditType,
ItemID,
Comment,
VersionComment,
CheckedOut,
Title,
BaseParagonDocumentNumber,
Author,
ClientDocumentNumber,
ClientDocumentType,
ClientJobNumber,
[Module],
Unit,
SequenceNumber,
RevisionDate,
ApprovedBy,
CheckedDepartmentManager,
CheckedLeadEngineerDesigner,
IssueType,
RevisedByDesigner,
RevisedByEngineer,
RevisionCode,
HSECheck,
CurrentVersionNumber,
CurrentVersionDate,
USER AS ChangedByUser,
@ModifiedDate AS DateChanged
FROM INSERTED INS

View 4 Replies View Related

SQL Server 2008 :: INSTEAD OF Trigger On A View

Mar 11, 2015

I have a view made up of a few base tables and another view. I have created an INSTEAD OF trigger on this view, but it doesn't seem to fire whenever a new record shows in the view. The purpose of the trigger is to insert a sister record in a table whenever a new record shown in the view. Here's the catch, the table that the trigger is supposed to insert into is not a base table within the view and the view is not an updatable view. My question is... Do INSTEAD OF triggers only affect the base table(s) within the view and does the view itself have to be an updatable view?

View 3 Replies View Related

Self Join Using Instead Of Update Trigger On A View

Jan 11, 2008

Hello all...I'd appreciate any help on this one.

I created a View...the view looks at four seperate tables.

Next, I created an Instead of Update trigger on that view. It works fine...for a regular UPDATE...SET.

However, it throws an error when I try an update and self join based on that view:

Update T1
Set RateUsed = T1.RateUsed
From Taxroll..Taxroll T1 Join
Taxroll..Taxroll T2 on
T1.Asmt = T2.Asmt and
T1.Taxyear = T2.Taxyear
Where T1.Asmt = '123456789012'
And T1.Taxyear = 2007
And T2.RollChgNum = ''
And T1.RollChgNum Like '%X'
And IsNull(T1.RateUsed,'') > ''

Msg 414, Level 16, State 1, Line 2
UPDATE is not allowed because the statement updates view "Taxroll..Taxroll" which participates in a join and has an INSTEAD OF UPDATE trigger.

There are a few caveats:
First, I thought the join issue was in the view itself. I re-created the view using no joins...all subqueries and still get the error. Second, I re-created the Instead of Update Trigger with no joins, and still get the error.

Thanks!

View 1 Replies View Related

Nested Trigger Error When Doing A Select On View?

Jan 9, 2013

In a SQL db we have we get the following error when just doing a simple select query against the view. Msg 217, Level 16, State 1...Maximum stored procedure, function, trigger, or view nesting level exceeded (limit 32).

No changes have been made to triggers or stored procedures recently and all was good prior to that.I understand that if my triggers loop this error will occur. But the select query does not fire any triggers functions or any other items. and the select worked with no issues last week.

Code:
SELECT TOP (100) PERCENT O.EID, O.OStart, O.OEnd, O.OID, T.Title, P.PStatus AS PS, dbo.CalcAge(O.OStart, ISNULL(O.OEnd, CURRENT_TIMESTAMP)) AS ODuration, O.PID,
O.Residence, O.b55, O.SplitItem, O.PeakStaff, O.ResidenceSub, O.Negotiator, O.Supervisor, O.TimeType, O.BreakPM, O.WorkEnd, O.Lunch, O.BreakAM, O.WorkBegin,

[code]....

View 4 Replies View Related

Update Trigger On Linked Server View

Jul 20, 2005

Hi there,I'm pretty new to SQL and am having some porblems with a linked server.I have a table on a SQL server which stores employee information.I also have a view on a linked server which stores the same information.What I would like to happen is, whenever the view changes on the linkedserver I want the information to be changed in the table on my server.I've been trying to write a trigger to do this, but have had noluck so far.Can anyone help me?ThanksSimon--Posted via http://dbforums.com

View 1 Replies View Related

Intead Of Update/insert Trigger On View Question

Dec 22, 2005

Hello all,SQL Server 2000 documentationhttp://www.microsoft.com/technet/pr...rt10/c3761.mspxstates that if view is using "NOT NULL" columns of a base table, theninsert/update performed on a view must provide dummy values for thosecolumns, and code of the trigger should ignore them.But I cannot reproduce this restriction. Code below pasted to QueryAnalysershows that I can not supply dummy values for "NOT NULL" fields when I updateview and still have update done. What do I miss ?VT/*--setup step 1. execute only inside of this commentSET NOCOUNT ONCREATE TABLE TestTable(keyField INT IDENTITY(1,1),dataField1 INT NOT NULL,dataField2 INT DEFAULT 1 NOT NULL)*//* --setup step 2. execute only inside of this commentCREATE VIEW TestView ASSELECT * FROM TestTable*//*--setup step 3. execute only inside of this commentCREATE TRIGGER TestViewTrig_IUON dbo.TestViewINSTEAD OF UPDATEASBEGINSET NOCOUNT ONUPDATE TestTableSETDataField1 = inserted.DataField1,DataField2 = inserted.DataField2FROMTestTable ttINNER JOINinsertedON inserted.KeyField = tt.KeyFieldEND*//*--setup step 4. execute only inside of this commentINSERT INTO TestTable (DataField1,DataField2) Values (1,2)INSERT INTO TestTable (DataField1,DataField2) Values (3,4)INSERT INTO TestTable (DataField1,DataField2) Values (5,6)*/SELECT * FROM TestView-- SQL Server lets me not specify DataField2 when update DataField1 orreverse,-- which is opposed to what documentation saysUPDATE TestView SET DataField1 = DataField1 + 1 where KeyField = 2UPDATE TestView SET DataField2 = DataField2 + 1 where KeyField = 3SELECT * FROM TestView/*-- remove test environmentDROP VIEW TestViewDROP TABLE TestTable*/

View 3 Replies View Related

Transact SQL :: Way To Have Trigger Fire When Something Happens To Tables That View Is Based On?

Nov 4, 2015

I created a view that joins several tables together and added an instead of insert, update trigger on it. My trigger works when I do an update/insert directly to the view, but it doesn't seem to fire when an insert/update is made to any of the tables that the view is based on. Is there a way to have the trigger fire when something happens to the tables that the view is based on? The application that the database is using is something that was purchased so I don't have access to the code to change any SQL statements that it's using.

View 5 Replies View Related

How To Get Information From System Table Or View For Trigger's Definition

May 29, 2008

Such as check all triggers that assign value to some columns ?

Thank you very much.

View 1 Replies View Related

Is There A Way To View Stored Procedure, Trigger AndFunction Usage In SQL Server?

Oct 11, 2006

I am maintaining an application where most of the business rules are inTriggers, Stored Procedures and User Defined Functions. When a bugarises, it can get very tedious to debug. Today for example, I wantedto modify a function that was being called by a trigger. The problemis that I don't want to change the function, for fear that it is beingcalled by one of the other SP's or triggers in the database (there arehundreds of them)Essentially, I need a tool that allows me to view where functions andsp's are being referenced from. At the very least, I'd like to performa "full text search" in the database objects, so that let's say I havea function named "fn_doSomething", I can search the schema for thisstring and get all the places where it appears.As you can see, I'm in the dark here. I've never worked on a systemwhere all business rules are at the database level. If you know of atool that does what I describe above, or anything else that wouldfacilitate my life, please let me know!Thanks for your help,Marc

View 5 Replies View Related

Urgent : Maximum Stored Procedure, Function, Trigger, Or View Nesting Level Exceeded

Aug 3, 2005

Hi all,

I have writen a Function which call's the same function it self. I'm getting the error as below.

Maximum stored procedure, function, trigger, or view nesting level exceeded (limit 32).
Can any one give me a solution for this problem I have attached the function also.

CREATE FUNCTION dbo.GetLegsFor(@IncludeParent bit, @EmployeeID float)
RETURNS @retFindReports TABLE (EmployeeID float, Name nvarchar(255), BossID float)
AS
BEGIN
IF (@IncludeParent=1)
BEGIN
INSERT INTO @retFindReports SELECT MemberId,Name,referredby FROM Amemberinfo WHERE Memberid=@EmployeeID
END
DECLARE @Report_ID float, @Report_Name nvarchar(255), @Report_BossID float
DECLARE RetrieveReports CURSOR STATIC LOCAL FOR
SELECT MemberId,Name,referredby FROM Amemberinfo WHERE referredby=@EmployeeID
OPEN RetrieveReports
FETCH NEXT FROM RetrieveReports INTO @Report_ID, @Report_Name, @Report_BossID
WHILE (@@FETCH_STATUS = 0)
BEGIN
INSERT INTO @retFindReports SELECT * FROM dbo.GetLegsFor(0,@Report_ID)
INSERT INTO @retFindReports VALUES(@Report_ID,@Report_Name, @Report_BossID)
FETCH NEXT FROM RetrieveReports INTO @Report_ID, @Report_Name, @Report_BossID
END
CLOSE RetrieveReports
DEALLOCATE RetrieveReports

RETURN
END

View 4 Replies View Related

Maximum Stored Procedure, Function, Trigger, Or View Nesting Level Exceeded (limit 32)

May 29, 2002

Hello,

I am running this query
"delete from ims_domains where id=61"
and got the error
Maximum stored procedure, function, trigger, or view nesting level exceeded (limit 32)


Please let me know what should be the reason?
Thanks,
Ravi

View 7 Replies View Related

Maximum Stored Procedure, Function, Trigger, Or View Nesting Level Exceeded (limit 32

Dec 1, 2004

Hi,

I face this error when i try to run my store procedure.
The sample of store procedure as following:

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE sp_addUserAccess
with encryption
AS
SET NOCOUNT ON

DECLARE @COUNTER INT
SET @COUNTER = 0

DECLARE @i_compId INT
BEGIN
DECLARE C1 SCROLL CURSOR FOR
SELECT i_compId
FROM ltd_cms_company WHERE (i_owner = 176 or i_owner = 268) AND ti_recStatus = 1
END

OPEN C1
FETCH ABSOLUTE @COUNTER FROM C1 INTO
@i_compId

WHILE @@FETCH_STATUS = 0
BEGIN
INSERT INTO ltd_cms_userAccess ( i_loginId, i_groupId, i_compId, ti_updComp, ti_updLog, ti_updAccess, ti_owner, ti_acctMgr, ti_updContact, ti_updEvent )
VALUES ( 124, 0, @i_compId, 1, 1, 1, 1, 1, 1, 1)

SET @COUNTER = @COUNTER + 1
FETCH ABSOLUTE @COUNTER FROM C1 INTO
@i_compId
END

CLOSE C1
DEALLOCATE C1
SET NOCOUNT OFF


anyone can help me identify this error?


Thanks


Regards,
Jojomay

View 1 Replies View Related

SQL Server 2014 :: Trigger On A View If Any Insert / Update Occurs On Base Table Level

Apr 21, 2015

I have a situation where I have Table A, Table B.

View C is created by joining table A and table B.

I have written a instead of trigger D on view C.

I do not insert/update/delete on the view directly.

For every insert/update in table A /B the values should get insert/update in the view respectively. This insert/update on view should invoke the trigger.

And I am unable to see this trigger work on the view if any insert/update occurs on base table level.

Trigger is working only if any operation is done directly on the view.

View 2 Replies View Related

Maximum Stored Procedure, Function, Trigger, Or View Nesting Level Exceeded (limit 32)

Jan 9, 2006

Hi all, I get this message when trying to update a tabel i have whichhas nested hierarchies.The current hierarchies beginning from root = 1 are up to the level 5.Before going into details and sample data with all the sql queries andprocedures, this limitation from Microsoft for nested levels .. isthere any way or trick to increase the level in generic?

View 1 Replies View Related

Maximum Stored Procedure, Function, Trigger, Or View Nesting Level Exceeded (limit 32).

Oct 16, 2007

I have created a delete trigger in Table1 and Table2. Once I delete a certain record in Table1 it will also delete that record in Table2 or vice versa. But once i delete certain record either in Table1 or Table2 it will create an error "Maximum stored procedure, function, trigger, or view nesting level exceeded (limit 32).". Can you help me on this?

View 4 Replies View Related

Creating Index On A View To Prevent Multiple Not Null Values - Indexed View?

Jul 23, 2005

I am looking to create a constraint on a table that allows multiplenulls but all non-nulls must be unique.I found the following scripthttp://www.windowsitpro.com/Files/0.../Listing_01.txtthat works fine, but the following lineCREATE UNIQUE CLUSTERED INDEX idx1 ON v_multinulls(a)appears to use indexed views. I have run this on a version of SQLStandard edition and this line works fine. I was of the understandingthat you could only create indexed views on SQL Enterprise Edition?

View 3 Replies View Related

Write A CREATE VIEW Statement That Defines A View Named Invoice Basic That Returns Three Columns

Jul 24, 2012

Write a CREATE VIEW statement that defines a view named Invoice Basic that returns three columns: VendorName, InvoiceNumber, and InvoiceTotal. Then, write a SELECT statement that returns all of the columns in the view, sorted by VendorName, where the first letter of the vendor name is N, O, or P.

This is what I have so far,

CREATE VIEW InvoiceBasic AS
SELECT VendorName, InvoiceNumber, InvoiceTotal
From Vendors JOIN Invoices
ON Vendors.VendorID = Invoices.VendorID

[code]...

View 2 Replies View Related

Calling A Stored Procedure From A View OR Creating A #tempTable In A View

Aug 24, 2007

Hi guys 'n gals,

I created a query, which makes use of a temp table, and I need the results to be displayed in a View. Unfortunately, Views do not support temp tables, as far as I know, so I put my code in a stored procedure, with the hope I could call it from a View....

I tried:

CREATE VIEW [qryMyView]
AS
EXEC pr_MyProc


and unfortunately, it does not let this run.

Anybody able to help me out please?

Cheers!

View 3 Replies View Related

Different Query Plans For View And View Definition Statement

Mar 9, 2006

I compared view query plan with query plan if I run the same statementfrom view definition and get different results. View plan is moreexpensive and runs longer. View contains 4 inner joins, statisticsupdated for all tables. Any ideas?

View 10 Replies View Related

CLR-Based Trigger? Recursive Trigger? Common Table Expression?

Nov 14, 2006

Hey,

I'm new to this whole SQL Server 2005 thing as well as database design and I've read up on various ways I can integrate business constraints into my database. I'm not sure which way applies to me, but I could use a helping hand in the right direction.

A quick explanation of the various tables I'm dealing with:
WBS - the Work Breakdown Structure, for example: A - Widget 1, AA - Widget 1 Subsystem 1, and etc.
Impacts - the Risk or Opportunity impacts for the weights of a part/assembly. (See Assemblies have Impacts below)
Allocations - the review of the product in question, say Widget 1, in terms of various weight totals, including all parts. Example - September allocation, Initial Demo allocation, etc. Mostly used for weight history and trending
Parts - There are hundreds of Parts which will eventually lead to thousands. Each part has a WBS element. [Seems redundant, but parts are managed in-house, and WBS elements are cross-company and issued by the Government]
Parts have Allocations - For weight history and trending (see Allocations). Example, Nut 17 can have a September 1st allocation, a September 5th allocation, etc.
Assemblies - Parts are assemblies by themselves and can belong to multiple assemblies. Now, there can be multiple parts on a product, say, an unmanned ground vehicle (UGV), and so those parts can belong to a higher "assembly" [For example, there can be 3 Nut 17's (lower assembly) on Widget 1 Subsystem 2 (higher assembly) and 4 more on Widget 1 Subsystem 5, etc.]. What I'm concerned about is ensuring that the weight roll-ups are accurate for all of the assemblies.
Assemblies have Impacts - There is a risk and opportunity impact setup modeled into this design to allow for a risk or opportunity to be marked on a per-assembly level. That's all this table represents.

A part is allocated a weight and then assigned to an assembly. The Assemblies table holds this hierarchical information - the lower assembly and the higher one, both of which are Parts entries in the [Parts have Allocations] table.

Therefore, to ensure proper weight roll ups in the [Parts have Allocations] table on a per part-basis, I would like to check for any inserts, updates, deletes on both the [Parts have Allocations] table as well as the [Assemblies] table and then re-calculate the weight roll up for every assembly. Now, I'm not sure if this is a huge performance hog, but I do need to keep all the information as up-to-date and as accurate as possible. As such, I'm not sure which method is even correct, although it seems an AFTER DML trigger is in order (from what I've gathered thus far). Keep in mind, this trigger needs to go through and check every WBS or Part and then go through and check all of it's associated assemblies and then ensure the weights are correct by re-summing the weights listed.

If you need the design or create script (table layout), please let me know.

Thanks.

View 4 Replies View Related

Trouble With Update Trigger Modifying Table Which Fired Trigger

Jul 20, 2005

Are there any limitations or gotchas to updating the same table whichfired a trigger from within the trigger?Some example code below. Hmmm.... This example seems to be workingfine so it must be something with my specific schema/code. We'reworking on running a SQL trace but if anybody has any input, fireaway.Thanks!create table x(Id int,Account varchar(25),Info int)GOinsert into x values ( 1, 'Smith', 15);insert into x values ( 2, 'SmithX', 25);/* Update trigger tu_x for table x */create trigger tu_xon xfor updateasbegindeclare @TriggerRowCount intset @TriggerRowCount = @@ROWCOUNTif ( @TriggerRowCount = 0 )returnif ( @TriggerRowCount > 1 )beginraiserror( 'tu_x: @@ROWCOUNT[%d] Trigger does not handle @@ROWCOUNT[color=blue]> 1 !', 17, 127, @TriggerRowCount) with seterror, nowait[/color]returnendupdate xsetAccount = left( i.Account, 24) + 'X',Info = i.Infofrom deleted, inserted iwhere x.Account = left( deleted.Account, 24) + 'X'endupdate x set Account = 'Blair', Info = 999 where Account = 'Smith'

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved