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 |
|
datagod
Starting Member
37 Posts |
Posted - 2006-05-29 : 12:47:16
|
| Hi, I did a bit a searching and could not find an easy solution.I am reading in employee information from a spreadsheet. The spreadsheet may or may not have already been processed. When I find a match in the database (based on an employee id) I need to determine if any of the columns contain new information. If so, I will update those columns.I am trying to avoid writing code to compare each column in the spreadsheet record with each colunn in the table. I am also trying to avoid updating every column because this would mess up my audits.Thanks for the input... |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2006-05-29 : 20:14:39
|
| You can genrate a dynamic sql statement to only update those columns that have changed.Perhaps better would be to change your audit trail to only log genuine updates rather than those which are updated to the same value.have a look athttp://www.nigelrivett.net/#TriggersThe code to generate the statement to update only columns that have changed will be similar to some of the code in the audit trails found there.==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
datagod
Starting Member
37 Posts |
Posted - 2006-05-30 : 07:24:02
|
| Thanks Nigel, great reading!! |
 |
|
|
|
|
|