Link to home
Start Free TrialLog in
Avatar of Butterfly2
Butterfly2

asked on

Copy records into a a table from the same table changing only one value

I have a table that has 6 fields , here is the query:

insert into [GSDR].[d2l].[d2l_reporting_SchoolPopulation]('2014-08-11',
      [Schoolcode],
      [School],
     [Cluster],
     [StudentCount],
      [IntructorCount])
     
 Select
        [Schoolcode],
      [School],
      [Cluster],
      [StudentCount]
       [IntructorCount]
 from [GSDR].[d2l].[d2l_reporting_SchoolPopulation]

I want to put in a population date of 2014-08, but basically copy all the other values.

here is my table

PopulationDate      Schoolcode       School                                             Cluster      StudentCount          IntructorCount
8/18/2014                978           ALCOVA ELEMENTARY SCHOOL             DACULA                    1133      71
8/18/2014                155            ALFORD ELEMENTARY SCHOOL       BERKMAR                   1021      62

This is want I want

PopulationDate      Schoolcode       School                                             Cluster      StudentCount          IntructorCount
8/18/2014                978           ALCOVA ELEMENTARY SCHOOL             DACULA                    1133      71
8/18/2014                155            ALFORD ELEMENTARY SCHOOL       BERKMAR                   1021      62
8/11/2014         978           ALCOVA ELEMENTARY SCHOOL             DACULA                    1133      71
8/11/2014                155            ALFORD ELEMENTARY SCHOOL       BERKMAR                   1021      62
ASKER CERTIFIED SOLUTION
Avatar of Deepak Subburajan
Deepak Subburajan

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Butterfly2
Butterfly2

ASKER

i am geting a syntax error on on the comma after the  '2014-08-11'.

Msg 102, Level 15, State 1, Line 3
Incorrect syntax near ','.
disregard, i removed the parenthesis and it works, thanks.