Ver Mensaje Individual
  #3 (permalink)  
Antiguo 09/05/2011, 06:04
chuchufuentes
 
Fecha de Ingreso: mayo-2008
Mensajes: 353
Antigüedad: 16 años
Puntos: 3
Respuesta: como hago este insert?

Cita:
Iniciado por ramiroli Ver Mensaje
Hola, Tenes que usar un campo identity, y meterlo en una tabla temporal. Ej:
Select Id = Identity(int,1,1),
Nombre = Descripcion
into _tmpAInsertar
From Clientes

insert into tabla2 Select * from _tmpAInsertar

La Funcion Identity recibe ('Tipo Dato', 'Primer Valor', 'Salto'). Solo se puede insertar en tablas temporales con el 'into'.
Si haces select Identity(int,5,2) el primer registro tiene el nro 5 y el segundo 5+2 y asi...
saludos
Gracias chamo, corriendo y haciendo