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 |
|
tmaiden
Yak Posting Veteran
86 Posts |
Posted - 2009-11-13 : 09:22:39
|
| I created an audit table and I would like to save old and new values. I am looking to dynamically set a field equal to the previous row value. Lets say for the sample, I have a table called TABLE_NAME with 2 fields TBL_CD and TBL_NMExample:FIELDSAUDIT_SKCHANGED_TABLECHANGED_BYCHANGED_ONORG_VALUENEW_VALUEOPERATIONNOTESSAMPLE DATA1TABLE_NAMELNAME.FNAME2009-11-12<TBL_CD>21</TBL_CD><TBL_NM>SOME VALUE</TBL_NM><TBL_CD>21</TBL_CD><TBL_NM>NEW VALUE</TBL_NM>UPDATEWHY THE NAME WAS CHANGEDAny suggestions on how to generate ORG_VALUE? Granted I don't want to hard-code each node in, I want to dynamically pull the name of the field. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-11-13 : 09:26:43
|
| have a look at for xml feature in sql. that should give you a start |
 |
|
|
|
|
|