Ver Mensaje Individual
  #2 (permalink)  
Antiguo 18/06/2012, 15:20
Avatar de Libras
Libras
Colaborador
 
Fecha de Ingreso: agosto-2006
Ubicación: En la hermosa perla de occidente
Mensajes: 7.412
Antigüedad: 17 años, 9 meses
Puntos: 774
Respuesta: trasferi datos

Código SQL:
Ver original
  1. --Primero agregas el campo a tu tabla
  2. ALTER TABLE tabla2 ADD rut INT
  3. GO
  4. --luego insertas los valores correspondientes
  5. INSERT INTO tabla2 (rut)
  6. SELECT t1.rut FROM tabla1 AS t1
  7. INNER JOIN tabla2 ON (t1.id=t2.id)
  8. WHERE t2.id IS NULL AND t1.id IS NOT NULL
  9. GO

saludos!
__________________
What does an execution plan say to t-sql query? Go f**k yourself, if you are not happy with me