Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
programer
Posting Yak Master
221 Posts |
Posted - 2010-11-01 : 17:05:49
|
Hi,I have two table:Parent Table1:Id, FirstNameChild Table2Id, FirstNameIn the Parent table FirstName data:JoeMarkThe child table FirstName data:MarkJoeJoeJoeFirst table, column FirstName, data = Joe.How to change data in seconed table, data = Joe.Instead, Joe, I want Joey to another table.How to change data in first table, column FirstName, data = Joe,This is my trigger:ALTER TRIGGER trg_YourTrigger ON dbo.Table1FOR UPDATEASUPDATE B.dbo.Table2SET ColumnY = I.ColumnXFROM inserted IINNER JOIN deleted DON I.ID = D.IDWHERE B.dbo.BB.ColumnY = D.ColumnXThe first table I want to change the FirstName and writes this:No row was updatedThe data in row1 was not committedError Source: .Net SqlClient Data Provider.Error Message: Invalid object name 'B.dbo.Table2. |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2010-11-01 : 20:15:00
|
[code]UPDATE B.dbo.Table2SET ColumnY = I.ColumnXFROM inserted IINNER JOINdeleted DON I.ID = D.IDWHERE B.dbo.BB.ColumnY = D.ColumnX[/code]should that be Table2 instead of BB ? KH[spoiler]Time is always against us[/spoiler] |
|
|
|
|
|