Sql trigger for updating one table from another

We've restricted the ability to create new threads on these forums. I'm still new with triggers but I get the basic idea. PLUNUMend..updates just column PLUNUMAny ideas how can I update the PLUTable2 when the PLUTable is getting updated? Jack Corbett Consultant Straight Path Solutions Dont let the good be the enemy of the best.-- Paul Fleming At best you can say that one job may be more secure than another, but total job security is an illusion.CEWII I have to jump on the bandwagon for this one as well.In the past, I've seen situations where triggers writing to linked servers caused severe production problems to the point that the application eventually became unusable.It is the field which we want to update with the value from the second table.Following script can be used as for the demonstration – CREATE TABLE [dbo].[T1]( [T1Id] [int] NULL, [T1Name] [varchar](50) NULL, [T1Category] [varchar](50) NULL, [T1Description] [varchar](50) NULL ) ON [PRIMARY] GO SET ANSI_PADDING OFF GO INSERT [dbo].[T1] ([T1Id], [T1Name], [T1Category], [T1Description]) VALUES (1, N'Name1', N'Cat1', N'Desc1') INSERT [dbo].[T1] ([T1Id], [T1Name], [T1Category], [T1Description]) VALUES (2, N'Name2', N'Cat2', N'Desc2') INSERT [dbo].[T1] ([T1Id], [T1Name], [T1Category], [T1Description]) VALUES (3, N'Name3', N'Cat3', N'Desc3') GO CREATE TABLE [dbo].[T2]( [T2Id] [int] NULL, [T2Title] [varchar](50) NULL, [T2Amount] [money] NULL, [T2Category] [varchar](50) NULL, [T2Description] [varchar](50) NULL ) ON [PRIMARY] GO INSERT [dbo].[T2] ([T2Id], [T2Title], [T2Amount], [T2Category], [T2Description]) VALUES (1, N'Title1', 200.0000, N'Cat1', NULL) INSERT [dbo].[T2] ([T2Id], [T2Title], [T2Amount], [T2Category], [T2Description]) VALUES (2, N'Title2', 100.0000, N'Cat2', NULL) INSERT [dbo].[T2] ([T2Id], [T2Title], [T2Amount], [T2Category], [T2Description]) VALUES (3, N'Title3', 400.0000, N'Cat3', NULL) INSERT [dbo].[T2] ([T2Id], [T2Title], [T2Amount], [T2Category], [T2Description]) VALUES (4, N'Title4', 300.0000, N'Cat1', NULL) Using the Code : Now, as we execute the above script we will have two tables as in the figures below- https://suvendugiri." data-medium-file="https://suvendugiri.files.wordpress.com/2012/01/001.png?

They both are in separated databases - tester and tester2 on the local computer. The software that we are given only works with PLUTable. In your case you want to look into Service Broker or roll your own queuing process.I wrote an introduction to triggers article that I would recommend you read as it discusses this type of issue.The copy has to be triggered when data is inserted at Source Server table.I encountered various issues starting from Linked server connection, collation issues to distributed transaction coordinator issues. Go to Server-New Login (I have used ‘Admin’ and ‘[email protected]’ as credentials.) c.If you need to keep server B updated choose another method like log shipping or transactional replication instead.The method you are looking at it rife with downsides and potential issues..With every Insert in Employee Details table in local server, we want the records to be inserted in destination server table as well. Enable network DTC access, allow inbound and outbound communication with no authentication required as shown in screenshot below:- I had different collations in columns of source table and destination table in actual production scenario.Majorly, there were below 5 steps that were followed:- 1. Source and Destination Servers were having different collations as mentioned below Source Server Collation: SQL_Latin1_General_CP1_CI_AI Destination Server Collation: Latin1_General_CI_AI So while creating stored procedure, it was failing on where clause in equal to operator with below error:- b.Regards Piotr ..your only reply is slàinte mhath I'm going to pile on here as well.A trigger should NOT be used to update data on another server or really do any action outside the database (cross database on the same server is probably okay).

Leave a Reply

Your email address will not be published. Required fields are marked *

One thought on “sql trigger for updating one table from another”

  1. BY WATCHING THIS: You acknowledge and agree that you shall not post, upload, publish, transmit or make available in any way content of this page including images and recording streamed live video available for download."I love a man that knows what he wants - someone who isn't afraid to act out his fantasies with me.