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 2005 Forums
 Transact-SQL (2005)
 Copy PK column to another

Author  Topic 

melon.melon
Yak Posting Veteran

76 Posts

Posted - 2009-05-28 : 04:05:00
Hi,
How can i copy the whole of primary key column to another column from the same table ?

The column i want to replace has other values and NULL value salso.

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2009-05-28 : 04:09:09
[code]
update t
set another_column = primary_key_column
from yourtable t
[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

melon.melon
Yak Posting Veteran

76 Posts

Posted - 2009-05-28 : 04:27:24
Thanks khtan!
Go to Top of Page
   

- Advertisement -