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 @ 4:28 PM
Points: 32,147, Visits: 16,539
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: Monday, June 8, 2015 9:14 AM
Points: 145, Visits: 349
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 @ 4:28 PM
Points: 32,147, Visits: 16,539
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 @ 2:01 PM
Points: 1,964, Visits: 6,597
I think it quite likely that it doesn't like you using BEGIN without an END...

MM


select geometry::STGeomFromWKB(0x0106000000020000000103000000010000000B0000001000000000000840000000000000003DD8CCCCCCCCCC0840000000000000003DD8CCCCCCCCCC08408014AE47E17AFC3F040000000000104000CDCCCCCCCCEC3F9C999999999913408014AE47E17AFC3F9C99999999991340000000000000003D0000000000001440000000000000003D000000000000144000000000000000400400000000001040000000000000F03F100000000000084000000000000000401000000000000840000000000000003D0103000000010000000B000000000000000000143D000000000000003D009E99999999B93F000000000000003D009E99999999B93F8014AE47E17AFC3F400000000000F03F00CDCCCCCCCCEC3FA06666666666FE3F8014AE47E17AFC3FA06666666666FE3F000000000000003D1800000000000040000000000000003D18000000000000400000000000000040400000000000F03F000000000000F03F000000000000143D0000000000000040000000000000143D000000000000003D, 0);


  • 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: Monday, June 8, 2015 9:14 AM
    Points: 145, Visits: 349
    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: Monday, June 8, 2015 9:14 AM
    Points: 145, Visits: 349
    Thank you... all is working!
    Post #1407282
    « Prev Topic | Next Topic »

    Add to briefcase ««12

    Permissions Expand / Collapse