Need to add a bunch of repetitive records to the database and don't want to do all of it by hand.
Need to add the intial records by hand but then want to create a query I can run to essentially template rest of the records and then just change the one different field by hand.
Problem is, I don't know exactly what the initial records are until I enter them.
For example
FieldOne | FieldTwo | FieldThree
----------+------------+--------------
Text One | Text Two A | int Three A
Text One | Text Two B | int Three A
Text One | Text Two C | int Three A
...
This all has to be done by hand. I then need to create:
FieldOne | FieldTwo | FieldThree
----------+------------+--------------
Text One | Text Two A | int Three B
Text One | Text Two B | int Three B
Text One | Text Two C | int Three B
...
... repeat for all the different values in Field Two.
Hope that makes sense?
Essentially what I want to do is:
WHILE (SELECT ALL DISTINCT VALUES FIELDTWO)
BEGIN
INSERT INTO TABLE VALUES ('Same all the time', Value From the FieldTwo Select, 'Same all the time')
END
Can this be done in SQL Server and can you give me the exact T-SQL statement to do it?
</br>tags since it's impossible now to reformat your code.