Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Select and Update
Message
 
 
To
30/11/2010 17:14:07
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2008
Application:
Web
Miscellaneous
Thread ID:
01491203
Message ID:
01491210
Views:
47
This message has been marked as a message which has helped to the initial question of the thread.
>>
>>
>>--SELECT Color.Title_E,Color2.Title_E AS Title_E2,Color,Color2 FROM RepairOrder
>>
>>UPDATE RepairOrder FROM RepairOrder
>>    SET Color2  = Color2.Title_E , Color = Color.Title_E
>> LEFT JOIN Color ON RepairOrder.NoColor=Color.Numero
>> LEFT JOIN Color AS Color2 ON RepairOrder.NoColor2=Color2.Numero
>>
>>
>>BTW, why are you using char(40) instead of varchar(40) ?
>
>This seems like an interesting approach. I tried it and got: "Incorrect syntax near the keyword 'FROM'" however.
>
>I am using Char(40) presently just to be conform with what I already have. At one point, I will do a massive update on some structures and will take care of that.

Move FROM just before the LEFT JOIN. Or try CTE approach.
UPDATE RepairOrder 
    SET Color2  = Color2.Title_E , Color = Color.Title_E
FROM RepairOrder

 LEFT JOIN Color ON RepairOrder.NoColor=Color.Numero
 LEFT JOIN Color AS Color2 ON RepairOrder.NoColor2=Color2.Numero
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform