November 15, 2005 at 2:36 pm
Hi all,
Is there any easy way to do it in T-SQL statement?
Thanks!
Betty
November 15, 2005 at 2:53 pm
If the columns are in the same table:
Update MyTable
set MyNewColumn = MyOldColumn
if the columns are in different tables:
Update MyNewTable
set MyNewColumn = (select MyOldColumn from MyOldTable where some criteria )
SQL = Scarcely Qualifies as a Language
November 15, 2005 at 3:54 pm
Carl,
That works (same table data). Thank you so much.
You know what I tried as follow before I saw your post.
update myTable set myNewColumn=(Select myOldColumn from myTable where ...)
it didn't work says that subquery have multiple values.
Betty
November 15, 2005 at 11:57 pm
update a set a.MyNewColumn = b.MyOldColumn from table1 a , table2 b where a.<keyfield> = b.<keyfield>
November 16, 2005 at 1:31 am
I'm in a picky mood today
Don't use this old legacy syntax:
update a set a.MyNewColumn = b.MyOldColumn from table1 a , table2 b where a.<keyfield> = b.<keyfield>
Use ANSI syntax instead:
update a set a.MyNewColumn = b.MyOldColumn from table1 a JOIN table2 b ON a.<keyfield> = b.<keyfield>
/Kenneth
November 29, 2005 at 4:19 pm
Is there an easy way to do this in sybase ISQL???
November 30, 2005 at 2:11 am
Have you tried the ANSI syntax in Sybase?
/Kenneth
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply