¬¬ pues nada mas agregas estos campos que quieres actualizar a tu select algo asi:
Código SQL:
Ver originalCREATE TABLE #temp
(
id INT IDENTITY(1,1),
nombre VARCHAR(10),
date1 datetime,
date2 datetime,
STATUS bit
)
INSERT INTO #temp VALUES ('libras',getdate(),getdate()-1,1)
INSERT INTO #temp VALUES ('libras1',getdate(),getdate()-2,0)
INSERT INTO #temp VALUES ('libras2',getdate(),getdate()-3,0)
INSERT INTO #temp VALUES ('libras3',getdate(),getdate()-4,1)
INSERT INTO #temp VALUES ('libras4',getdate(),getdate()-5,1)
SELECT * FROM #temp
id nombre date1 date2 STATUS
1 libras 2012-04-18 11:22:18.853 2012-04-17 11:22:18.853 1
2 libras1 2012-04-18 11:22:18.853 2012-04-16 11:22:18.853 0
3 libras2 2012-04-18 11:22:18.853 2012-04-15 11:22:18.853 0
4 libras3 2012-04-18 11:22:18.853 2012-04-14 11:22:18.853 1
5 libras4 2012-04-18 11:22:18.853 2012-04-13 11:22:18.853 1
UPDATE #temp
SET date1=t1.fecha,
nombre=t1.nombre,
STATUS=t1.STATUS
FROM
(
SELECT id,CASE WHEN STATUS=1 THEN date2 ELSE date1 END AS fecha,'sin nombre' AS nombre,
CASE WHEN STATUS=1 THEN 0 ELSE 1 END AS STATUS FROM #temp
) AS t1 WHERE t1.id=#temp.id
SELECT * FROM #temp
id nombre date1 date2 STATUS
1 sin nombre 2012-04-17 11:22:18.853 2012-04-17 11:22:18.853 0
2 sin nombre 2012-04-18 11:22:18.853 2012-04-16 11:22:18.853 1
3 sin nombre 2012-04-18 11:22:18.853 2012-04-15 11:22:18.853 1
4 sin nombre 2012-04-14 11:22:18.853 2012-04-14 11:22:18.853 0
5 sin nombre 2012-04-13 11:22:18.853 2012-04-13 11:22:18.853 0
El mismo query actualizando "muchos" datos