Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

concern

Status
Not open for further replies.

coachvi

Technical User
Nov 19, 2008
111
0
0
GH
CREATE TRIGGER trgInsteadOfUpdate1 ON dbo.Domod
INSTEAD OF INSERT
AS

-- Insert into Region
UPDATE OEORDD
SET EXTINVMISC != 0
FROM OEORDD INNER JOIN
Domod ON OEORDD.ORDUNIQ = Domod.ORDUNIQ
GO


kindly tell da problem want to update a table from a view table dat i ve created
 
!= means not equal.

You can't set a value not equal to something. You would have to set it equal to something.

Simi
 
The != is not a valid assignment operator, use = instead. != (not equal) is valid in comparisons.

I keep trying to do something about my procrastination but I keep putting it off until tomorrow.
 
In addition to other replies, perhaps you also want to join with the Inserted table, because otherwise this trigger doesn't make much sense. Also, the trigger is named InsteadOfUpdate but executed for INSTEAD OF INSERT and performs an update - I suspect it should be INSTEAD OF UPDATE trigger. Can you explain what this trigger is supposed to do to get better help?

PluralSight Learning Library
 
here is the script of the table


USE [domdat]
GO

/****** Object: Table [dbo].[OEORDD] Script Date: 03/15/2012 09:18:28 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[OEORDD](
[ORDUNIQ] [decimal](19, 0) NOT NULL,
[LINENUM] [smallint] NOT NULL,
[AUDTDATE] [decimal](9, 0) NOT NULL,
[AUDTTIME] [decimal](9, 0) NOT NULL,
[AUDTUSER] [char](8) NOT NULL,
[AUDTORG] [char](6) NOT NULL,
[LINETYPE] [smallint] NOT NULL,
[ITEM] [char](24) NOT NULL,
[MISCCHARGE] [char](6) NOT NULL,
[DESC] [char](60) NOT NULL,
[ACCTSET] [char](6) NOT NULL,
[USERCOSTMD] [smallint] NOT NULL,
[PRICELIST] [char](6) NOT NULL,
[CATEGORY] [char](6) NOT NULL,
[LOCATION] [char](6) NOT NULL,
[PICKSEQ] [char](10) NOT NULL,
[EXPDATE] [decimal](9, 0) NOT NULL,
[STOCKITEM] [smallint] NOT NULL,
[QTYORDERED] [decimal](19, 4) NOT NULL,
[QTYSHIPPED] [decimal](19, 4) NOT NULL,
[QTYBACKORD] [decimal](19, 4) NOT NULL,
[QTYSHPTODT] [decimal](19, 4) NOT NULL,
[ORIGQTY] [decimal](19, 4) NOT NULL,
[QTYPO] [decimal](19, 4) NOT NULL,
[ORDUNIT] [char](10) NOT NULL,
[UNITCONV] [decimal](19, 6) NOT NULL,
[UNITPRICE] [decimal](19, 6) NOT NULL,
[PRICEOVER] [smallint] NOT NULL,
[UNITCOST] [decimal](19, 6) NOT NULL,
[MOSTREC] [decimal](19, 6) NOT NULL,
[STDCOST] [decimal](19, 6) NOT NULL,
[COST1] [decimal](19, 6) NOT NULL,
[COST2] [decimal](19, 6) NOT NULL,
[UNITPRCDEC] [smallint] NOT NULL,
[PRICEUNIT] [char](10) NOT NULL,
[PRIUNTPRC] [decimal](19, 6) NOT NULL,
[PRIUNTCONV] [decimal](19, 6) NOT NULL,
[PRIPERCENT] [decimal](9, 5) NOT NULL,
[PRIAMOUNT] [decimal](19, 3) NOT NULL,
[BASEUNIT] [char](10) NOT NULL,
[PRIBASPRC] [decimal](19, 6) NOT NULL,
[PRIBASCONV] [decimal](19, 6) NOT NULL,
[COSTUNIT] [char](10) NOT NULL,
[COSUNTCST] [decimal](19, 6) NOT NULL,
[COSUNTCONV] [decimal](19, 6) NOT NULL,
[EXTOPRICE] [decimal](19, 3) NOT NULL,
[EXTOCOST] [decimal](19, 3) NOT NULL,
[EXTINVMISC] [decimal](19, 3) NOT NULL,
[INVDISC] [decimal](19, 3) NOT NULL,
[EXTICOST] [decimal](19, 3) NOT NULL,
[EXTOVER] [smallint] NOT NULL,
[UNITWEIGHT] [decimal](19, 4) NOT NULL,
[EXTWEIGHT] [decimal](19, 4) NOT NULL,
[COMPLETE] [smallint] NOT NULL,
[ADDTOILOC] [smallint] NOT NULL,
[SALESLOST] [decimal](19, 3) NOT NULL,
[TAUTH1] [char](12) NOT NULL,
[TAUTH2] [char](12) NOT NULL,
[TAUTH3] [char](12) NOT NULL,
[TAUTH4] [char](12) NOT NULL,
[TAUTH5] [char](12) NOT NULL,
[TCLASS1] [smallint] NOT NULL,
[TCLASS2] [smallint] NOT NULL,
[TCLASS3] [smallint] NOT NULL,
[TCLASS4] [smallint] NOT NULL,
[TCLASS5] [smallint] NOT NULL,
[TINCLUDED1] [smallint] NOT NULL,
[TINCLUDED2] [smallint] NOT NULL,
[TINCLUDED3] [smallint] NOT NULL,
[TINCLUDED4] [smallint] NOT NULL,
[TINCLUDED5] [smallint] NOT NULL,
[TBASE1] [decimal](19, 3) NOT NULL,
[TBASE2] [decimal](19, 3) NOT NULL,
[TBASE3] [decimal](19, 3) NOT NULL,
[TBASE4] [decimal](19, 3) NOT NULL,
[TBASE5] [decimal](19, 3) NOT NULL,
[TAMOUNT1] [decimal](19, 3) NOT NULL,
[TAMOUNT2] [decimal](19, 3) NOT NULL,
[TAMOUNT3] [decimal](19, 3) NOT NULL,
[TAMOUNT4] [decimal](19, 3) NOT NULL,
[TAMOUNT5] [decimal](19, 3) NOT NULL,
[TRATE1] [decimal](15, 5) NOT NULL,
[TRATE2] [decimal](15, 5) NOT NULL,
[TRATE3] [decimal](15, 5) NOT NULL,
[TRATE4] [decimal](15, 5) NOT NULL,
[TRATE5] [decimal](15, 5) NOT NULL,
[DETAILNUM] [smallint] NOT NULL,
[COMMINST] [smallint] NOT NULL,
[GLNONSTKCR] [char](45) NOT NULL,
[AVGCOST] [decimal](19, 6) NOT NULL,
[LASTCOST] [decimal](19, 6) NOT NULL,
[COPYDETAIL] [smallint] NOT NULL,
[QUONUMBER] [char](22) NOT NULL,
[QUODTLNUM] [smallint] NOT NULL,
[SHIPTRACK] [char](36) NOT NULL,
[SHIPVIA] [char](6) NOT NULL,
[VIADESC] [char](60) NOT NULL,
[DISCPER] [decimal](9, 5) NOT NULL,
[QTYCOMMIT] [decimal](19, 4) NOT NULL,
[MANITEMNO] [char](24) NOT NULL,
[CUSTITEMNO] [char](24) NOT NULL,
[QTYTRUECOM] [decimal](19, 4) NOT NULL,
[VALUES] [int] NOT NULL,
[DDTLTYPE] [smallint] NOT NULL,
[DDTLNO] [char](6) NOT NULL,
[BUILDQTY] [decimal](19, 4) NOT NULL,
[BUILDUNIT] [char](10) NOT NULL,
[BLDUNTCONV] [decimal](19, 6) NOT NULL,
[FRMNUMBER] [char](22) NOT NULL,
[NEXTCMPNUM] [int] NOT NULL,
[EPOSPROMID] [smallint] NOT NULL,
[BASEWUNIT] [char](10) NOT NULL,
[WEIGHTUNIT] [char](10) NOT NULL,
[WEIGHTCONV] [decimal](19, 6) NOT NULL,
[PRWGHTUNIT] [char](10) NOT NULL,
[PRWGHTCONV] [decimal](19, 6) NOT NULL,
[PRIBASWCNV] [decimal](19, 6) NOT NULL,
[DEFUWEIGHT] [decimal](19, 4) NOT NULL,
[DEFEXTWGHT] [decimal](19, 4) NOT NULL,
[PRPRICEBY] [smallint] NOT NULL,
[NEEDPCHECK] [smallint] NOT NULL,
[CAPPROVEBY] [char](8) NOT NULL,
[HDRDISC] [decimal](19, 3) NOT NULL,
[OTRAMOUNT1] [decimal](19, 3) NOT NULL,
[OTRAMOUNT2] [decimal](19, 3) NOT NULL,
[OTRAMOUNT3] [decimal](19, 3) NOT NULL,
[OTRAMOUNT4] [decimal](19, 3) NOT NULL,
[OTRAMOUNT5] [decimal](19, 3) NOT NULL,
[PSPRINTED] [smallint] NOT NULL,
[JOBRELATED] [smallint] NOT NULL,
[CONTRACT] [char](16) NOT NULL,
[PROJECT] [char](16) NOT NULL,
[CCATEGORY] [char](16) NOT NULL,
[COSTCLASS] [smallint] NOT NULL,
[PROJSTYLE] [smallint] NOT NULL,
[PROJTYPE] [smallint] NOT NULL,
[REVREC] [smallint] NOT NULL,
[BILLTYPE] [smallint] NOT NULL,
[REVBILL] [char](45) NOT NULL,
[COGSWIP] [char](45) NOT NULL,
[RTGPERCENT] [decimal](9, 5) NOT NULL,
[RTGDAYS] [smallint] NOT NULL,
[PRICEOPT] [smallint] NOT NULL,
[ARITEMNO] [char](16) NOT NULL,
[ARUNIT] [char](10) NOT NULL,
[PAYMNTDIST] [decimal](19, 3) NOT NULL,
[SERIALQTY] [int] NOT NULL,
[LOTQTY] [decimal](19, 4) NOT NULL,
[SQTYMOVED] [int] NOT NULL,
[LQTYMOVED] [decimal](19, 4) NOT NULL,
[SLITEM] [smallint] NOT NULL,
CONSTRAINT [OEORDD_KEY_0] PRIMARY KEY CLUSTERED
(
[ORDUNIQ] ASC,
[LINENUM] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

 
i ve created a view on the table


USE [domdat]
GO

/****** Object: View [dbo].[Domod] Script Date: 03/15/2012 09:21:42 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

-- Batch submitted through debugger: SQLQuery7.sql|11|0|C:\Users\ATG_Demo\AppData\Local\Temp\~vs11E0.sql
CREATE VIEW [dbo].[Domod]
AS
SELECT UNITPRICE * QTYORDERED * CAST(MANITEMNO AS Decimal(18, 3)) AS total, ORDUNIQ, EXTINVMISC,LINENUM
FROM dbo_OEORDD
WHERE (ISNUMERIC(MANITEMNO) = 1)



GO

 
now i want to create a trigger on this view to update this column ([EXTINVMISC] [decimal](19, 3) NOT NULL,) on the first table

kndly help me
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top