Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««12

trigger that will update one table when a record is updated in another Expand / Collapse
Author
Message
Posted Monday, January 14, 2013 2:32 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: Administrators
Last Login: Today @ 12:57 PM
Points: 33,206, Visits: 15,361
Do you have an asterisk in your code? I thought you were using the to mark the place you were writing about.

No asterisks needed in your code.







Follow me on Twitter: @way0utwest

Forum Etiquette: How to post data/code on a forum to get the best help
Post #1406948
Posted Monday, January 14, 2013 2:34 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Thursday, March 13, 2014 2:33 PM
Points: 117, Visits: 315
Correct... the asterick was just to show in the post where the problem was. There's no asterick in the code.
Post #1406949
Posted Monday, January 14, 2013 3:00 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: Administrators
Last Login: Today @ 12:57 PM
Points: 33,206, Visits: 15,361
you may need to qualify as I mentioned:

USE [TrackIT]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TRIGGER [dbo].[trUpdateBulkPurchases]
ON [dbo].[tblTransactions]
AFTER UPDATE
AS
BEGIN
UPDATE tblBulkPurchases
SET
PO_Number = i.PO_Number,
Quantity = i.Quantity,
Unit_Price = i.Unit_Price,
Software_Description = i.Software_Description,
PO_Date = i.PO_Date,
PurchaseCostCenter = i.PurchaseCostCenter,
HeatTicketNumber = i.HeatTicketNumber,
PurchaseAccount = i.PurchaseAccount,
Transaction_Date = i.Transaction_Date,
SoftwareShortName = i.SoftwareShortName
FROM INSERTED i
inner join tblBulkPurchases
on tblBulkPurchases.Transaction_Number = i.Transaction_Number
WHERE tblBulkPurchases.Transaction_Type = 'Bulk Purchase'








Follow me on Twitter: @way0utwest

Forum Etiquette: How to post data/code on a forum to get the best help
Post #1406955
Posted Monday, January 14, 2013 5:40 PM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Today @ 12:18 PM
Points: 1,787, Visits: 5,699
I think it quite likely that it doesn't like you using BEGIN without an END...

MM


  • MMGrid Addin
  • MMNose Addin


  • Forum Etiquette: How to post Reporting Services problems
  • Forum Etiquette: How to post data/code on a forum to get the best help - by Jeff Moden
  • How to Post Performance Problems - by Gail Shaw

  • Post #1406995
    Posted Tuesday, January 15, 2013 8:05 AM
    SSC-Enthusiastic

    SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

    Group: General Forum Members
    Last Login: Thursday, March 13, 2014 2:33 PM
    Points: 117, Visits: 315
    Thank you... all is working!
    Post #1407281
    Posted Tuesday, January 15, 2013 8:06 AM
    SSC-Enthusiastic

    SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

    Group: General Forum Members
    Last Login: Thursday, March 13, 2014 2:33 PM
    Points: 117, Visits: 315
    Thank you... all is working!
    Post #1407282
    « Prev Topic | Next Topic »

    Add to briefcase ««12

    Permissions Expand / Collapse