Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 cloning record

Author  Topic 

misterraj
Yak Posting Veteran

94 Posts

Posted - 2014-11-30 : 02:33:48
I have a table for eg : table1 with three columns col1 col2 and col3.
I want to copy a record row1 from table1 and insert into the same table1
but want to change the value of col3 only.


i/e.. clone the record but have to change the value of col3 only.

can any one assist me with the query.

venkat.

mandm
Posting Yak Master

120 Posts

Posted - 2014-11-30 : 08:24:34
INSERT INTO Table1 (Co1, Col2, Col3)
SELECT Col1
, Col2
, <New Value> AS Col3
FROM Table1
WHERE <How to identify Row1>
Go to Top of Page

misterraj
Yak Posting Veteran

94 Posts

Posted - 2014-12-01 : 08:46:08
O ! thanks. It worked. great.
Go to Top of Page

mandm
Posting Yak Master

120 Posts

Posted - 2014-12-01 : 09:28:13
You're welcome.
Go to Top of Page
   

- Advertisement -