Thursday, October 21, 2010

Duplicate a column of a table in SQL Server

To duplicate an existing column in a table.

Assume a we have table 'Test' with columns col1( varchar(10)) and col2(varchar(10))
Assume we have values present in col1.

Use the following simple query to duplicate col2 by taking values from col1

UPDATE Test
SET col2= col1

No comments:

Post a Comment