Skip to content Skip to sidebar Skip to footer

Looping Sql Statement Insert

I want to insert each time a line with the date + 1. It's a simple SQL loop. I'm using SSIS, so the StartDate and Enddate are variables. Here is my code: WITH View_Solidnet_Trainin

Solution 1:

No need for VALUES in INSERT...SELECT statement.

Replace

INSERTINTO OBJ_Availability
VALUESSELECT34,
         DateValue +1,
         'AM',
         2,
         'Test'FROM   View_Solidnet_Training;

with

INSERTINTO OBJ_Availability
SELECT34,
       DateValue +1,
       'AM',
       2,
       'Test'FROM   View_Solidnet_Training;

Post a Comment for "Looping Sql Statement Insert"