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 |
|
mhg1063
Starting Member
27 Posts |
Posted - 2004-09-29 : 16:01:36
|
| I have a table that has a few columns where we are doing some minor auditing. The table has a intial,current,previous column. Initial is when its first inserted to the table current & previous gets populated everyday. If I update previous with current, can I set current to null in the same update statement. |
|
|
DustinMichaels
Constraint Violating Yak Guru
464 Posts |
Posted - 2004-09-29 : 16:05:31
|
| I believe your allowed to do that. |
 |
|
|
ditch
Master Smack Fu Yak Hacker
1466 Posts |
Posted - 2004-09-29 : 16:08:36
|
| Yes You Can[CODE]CREATE TABLE #TEST(Initial INT, [Current] INT, Previous INT)INSERT INTO #TESTSELECT 1, 2, 3 UNION ALLSELECT 4, 5, 6 UNION ALLSELECT 7, 8, 9 UNION ALLSELECT 10, 11, 12 UNION ALLSELECT 13, 14, 15SELECT * FROM #TestUPDATE #TESTSET Previous = [Current], [Current] = NULLSELECT * FROM #Test[/CODE]Duane. |
 |
|
|
mhg1063
Starting Member
27 Posts |
Posted - 2004-09-29 : 16:28:11
|
| Thanks .. |
 |
|
|
|
|
|
|
|