Ver Mensaje Individual
  #3 (permalink)  
Antiguo 28/04/2009, 06:42
Avatar de Andres95
Andres95
Colaborador
 
Fecha de Ingreso: diciembre-2004
Mensajes: 1.802
Antigüedad: 19 años, 5 meses
Puntos: 38
Respuesta: Insercion Masiva de Registros

Desde la fecha actual hasta 31 de dic de 20014 solo son 41,480 registros...


Una forma facil de calcular los registros es haciendo un ciclo...

Considerando que sera una carga inicial y no algo de todos los dias...

Código:
DECLARE @Date_Start datetime, @Date_End datetime


SET @Date_Start = convert(varchar, getdate(), 112)
SET @Date_End = '20141231'

While @Date_Start <= @Date_End
BEGIN


    INSERT INTO TURNOS VALUES(@Date_Start,'08.00 hrs',0)
    INSERT INTO TURNOS VALUES(@Date_Start,'08.30 hrs',0)
    INSERT INTO TURNOS VALUES(@Date_Start,'09.00 hrs',0)
    INSERT INTO TURNOS VALUES(@Date_Start,'09.30 hrs',0)
    INSERT INTO TURNOS VALUES(@Date_Start,'10.00 hrs',0)
    INSERT INTO TURNOS VALUES(@Date_Start,'10.30 hrs',0)
    INSERT INTO TURNOS VALUES(@Date_Start,'11.00 hrs',0)
    INSERT INTO TURNOS VALUES(@Date_Start,'11.30 hrs',0)
    INSERT INTO TURNOS VALUES(@Date_Start,'12.00 hrs',0)
    INSERT INTO TURNOS VALUES(@Date_Start,'12.30 hrs',0)
    INSERT INTO TURNOS VALUES(@Date_Start,'16.00 hrs',0)
    INSERT INTO TURNOS VALUES(@Date_Start,'16.30 hrs',0)
    INSERT INTO TURNOS VALUES(@Date_Start,'17.00 hrs',0)
    INSERT INTO TURNOS VALUES(@Date_Start,'17.00 hrs',0)
    INSERT INTO TURNOS VALUES(@Date_Start,'18.00 hrs',0)
    INSERT INTO TURNOS VALUES(@Date_Start,'18.00 hrs',0)
    INSERT INTO TURNOS VALUES(@Date_Start,'19.00 hrs',0)
    INSERT INTO TURNOS VALUES(@Date_Start,'19.00 hrs',0)
    INSERT INTO TURNOS VALUES(@Date_Start,'20.00 hrs',0)
    INSERT INTO TURNOS VALUES(@Date_Start,'20.00 hrs',0) 
 
    SET @Date_Start = @Date_Start + 1

END
Saludos!
__________________
La sencillez y naturalidad son el supremo y último fin de la cultura...
--
MCTS : SQL Server 2008, .NET Framework 3.5, ASP.NET Applications.