Yes. Try this:
- insert into yourtable (col1, col2, col3, col4)
-
(select 'ThisIsTheCopy' as col1, col2, col3, col4 from yourtable where thisfield = 'thisvalue')
-
-- CK
I am sorry - was in a rush earlier. Here is better explanation of the problem:
Table has: col1, col2, col3 - for example could be State, County, City plus other columns.
I need to insert duplicates of some group of records but to change column to a different value.
I know this will insert duplicates for col1 = somevalue
INSERT INTO Table VALUES ( SELECT * FROM Table WHERE col1 = somevalue)
How can I change the col1 into "othervalue" just for duplicate records not the originals?
Is it possible to do it on the fly?
Also, prefer not to use column names in SELECT because column names will vary in different tables but I do know column name to use in WHERE clause and that the column that needs to be changed.
Thanks.