Sqlserver
 SQL >> Database >  >> RDS >> Sqlserver

SQL Server: UPDATE MyTable SET col1 = value, col2 = col1

Ecco un'altra alternativa da provare:

DECLARE @x float; UPDATE MyTable SET @x = col1 = formula, col2 = @x * … OPTION (MAXDOP 1) 

oppure:

DECLARE @x float; UPDATE MyTable SET @x = formula, col1 = @x, col2 = @x * … OPTION (MAXDOP 1) 

OPTION (MAXDOP 1) è lì per garantire l'ordine sequenziale di valutazione delle assegnazioni.