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 |
|
munkdogg
Yak Posting Veteran
53 Posts |
Posted - 2008-02-11 : 15:06:39
|
| Hello,This is my first SQL trigger. I trying to create a trigger that will capture update operations on multiple columns within the same table, and output the content of those updates to a .txt file, local on the server.I have searched this forum, but cannot locate the syntax of this command. Would someone be so kind as to provide an outline of the syntax required to do this? ie;CREATE TRIGGER [Table_Change] ON [dbo].[table1] FOR UPDATEASUpdate (column1, column2, column3)etc, etc....Many thanks to all who reply. If I have overlooked this information already posted here, please direct me to the proper location.Cheers. |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2008-02-11 : 15:09:31
|
| you won't find it because it's really not recommendable to do that.why are you trying to do this?you can do this with using bcp and xp_cmdshell_______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenpSSMS Add-in that does a few things: www.ssmstoolspack.com <- new version out |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-02-11 : 15:10:39
|
IF UPDATE(Col1) OR UPDATE(Col2) OR UPDATE(Col3)BEGIN-- Have a look at BCP for outputting txt-file-- Also read about INSERTED and DELETED virtual tables.END E 12°55'05.25"N 56°04'39.16" |
 |
|
|
munkdogg
Yak Posting Veteran
53 Posts |
Posted - 2008-02-11 : 15:19:02
|
| Can you explain on why this is not recommended? I went the .txt file route because these updates 'supposed' to be synched with another database, on another server (which just happens to be running SQL2K5). I understood the two versions cannot (or rather, do not) synch values between tables in this manner. Therefore, the txt file is output from one database and input to the other database. Am I off-base here? |
 |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2008-02-11 : 15:20:59
|
| i'm not really sure what you mean... but this sounds like a job for replication.can you give us a clear example?_______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenpSSMS Add-in that does a few things: www.ssmstoolspack.com <- new version out |
 |
|
|
munkdogg
Yak Posting Veteran
53 Posts |
Posted - 2008-02-11 : 15:34:59
|
| Can data from a SQL 2000 database be replicated to a SQL 2005 database? My understanding was that no, it could not. Am I incorrect? That would certainly be easier! |
 |
|
|
jezemine
Master Smack Fu Yak Hacker
2886 Posts |
Posted - 2008-02-11 : 19:21:59
|
triggers should be local and fast. any transaction that causes the trigger to fire will have to wait for the trigger to complete for it to commit. so if your trigger is launching external apps via xp_cmdshell or otherwise long running stuff, the perf of your app will deteriorate rapidly. elsasoft.org |
 |
|
|
|
|
|
|
|