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 |
|
xrum
Yak Posting Veteran
87 Posts |
Posted - 2011-02-22 : 09:30:58
|
| i've been looking though different tutorials online,but i can't seem to find what i need.I need to copy a record into a history table, every time it is updated.Is there a way to do it with triggers without having to type out all of my data fields? |
|
|
MIK_2008
Master Smack Fu Yak Hacker
1054 Posts |
Posted - 2011-02-22 : 12:34:43
|
| if you are using SLQ 2008, have a look at Change Data Capture ... hope that helps |
 |
|
|
xrum
Yak Posting Veteran
87 Posts |
Posted - 2011-02-22 : 14:35:31
|
| i did the following:TRIGGER [dbo].[trg_SourceHistory] ON [dbo].[tblSource]for UPDATEAS INSERT INTO tblHistorySourceselect *, getdate()from INSERTED BEGIN RAISERROR('Error in Source Hisotry Trigger' ,16,1) ROLLBACK TRAN ENDbut i'm getting an error in the trigger when trying to execute an update on that table, so no changes are saved. please ehlp |
 |
|
|
xrum
Yak Posting Veteran
87 Posts |
Posted - 2011-02-22 : 15:12:41
|
| nevermind :) i got it |
 |
|
|
|
|
|