tsql - updating a table from a select statement

后端 未结 2 1218
闹比i
闹比i 2021-01-27 13:38

I have two tables. TableA and TableB.
TableA holds a varbinary(max) column - named [BinaryA] TableB holds a column (named \"Volume\", type \"Long\") that contains each varbi

2条回答
  •  梦谈多话
    2021-01-27 14:33

    Try with this query:

    UPDATE TableB 
    SET TableB.[VOLUME] = DATALENGTH([T2.Binary])
    FROM TableB
    INNER JOIN [VAULT].[TABLEA] T2 ON TableB.TAL_ID = T2.TAL_ID
    

    Assuming that TableB and [VAULT].[TABLEA] are related by ID field.

提交回复
热议问题