I am using Sql Server 2005. I have this tableA with 70 columns and about 5000rows. I would like to create new data(around 200 new records) for simulation purposes. Out of the 70 columns, i only want to change values of 3 columns (TERMID, OUTLET, SNUM) the rest remains. E.g
TABLEA
SNO COMPANY.......TERMID........OUTLET........SNUM.....
1 ABC PP2 P1-P5 P5
1 ABC PP2 P1-P5 P4
2 ABC PP2 P1-P5 P4
1 ABC PP2 P1-P5 P3
3 ABC PP2 P1-P5 P3
so i would like to keep all values for the new records except changing all TERMID from PP2 to PP3 and all outlet from P1-P5 to P6-P8. As for SNUM all P5 will become P8, P4 will become P7 and P3 will become P6. Meaning TABLEA will look like this after i do the insert:
TABLEA
SNO COMPANY.......TERMID........OUTLET........SNUM.....
1 ABC PP2 P1-P5 P5
1 ABC PP2 P1-P5 P4
2 ABC PP2 P1-P5 P4
1 ABC PP2 P1-P5 P3
3 ABC PP2 P1-P5 P3
1 ABC PP3 P6-P8 P8
1 ABC PP3 P6-P8 P7
2 ABC PP3 P6-P8 P7
1 ABC PP3 P6-P8 P6
3 ABC PP3 P6-P8 P6
I do not want to do this manually as it will be very tedious for 200 rows. Is this possible using SQL statements?
I have tot of writing normal insert statements with subquery but i guess it will be as tedious or maybe even more to write INSERT INTO TABLEA ( COL1, COL2,…….COL70) VALUE (…..)
Any smart idea?
I just reread your response, and realize you’re trying to Insert records in your current table, not create a new table.
How about:
Sorry for the confusion.