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 2000 Forums
 Transact-SQL (2000)
 How can I update a field with another field value

Author  Topic 

tomex1
Starting Member

47 Posts

Posted - 2008-02-12 : 05:47:26

Hello,
I was wondering how to do this: I have a contact table in SQL with the firstname in a field called 'firstname1' and the surname in a field called 'surname1', how can I copy all the data in these two fields into the correct fields which is 'firstname' and 'surname' respectively?

Many thanks

sunil
Constraint Violating Yak Guru

282 Posts

Posted - 2008-02-12 : 05:56:49
Do you have 'firstname' and 'surname' columns in your table other than 'firstname1' and 'surname1'. If yes, then, you can do like,

Update yourtablename
set firstname=firstname1,surname=surname1 from yourtablename

If this is not the case, post table structure of your table.

Go to Top of Page

tomex1
Starting Member

47 Posts

Posted - 2008-02-12 : 06:00:50
quote:
Originally posted by sunil

Do you have 'firstname' and 'surname' columns in your table other than 'firstname1' and 'surname1'. If yes, then, you can do like,

Update yourtablename
set firstname=firstname1,surname=surname1 from yourtablename

If this is not the case, post table structure of your table.





Yes, I do and that worked. Thanks a lot!!!!!!!
Go to Top of Page
   

- Advertisement -