update的一种用法

declare @aa int

set @aa = 1

 

update EWC_HT_Contract

set ContractCode = a.ContractCode + cast (@aa as nvarchar(10)),@aa = @aa +1

from

(

    select ContractCode

    from  Contract

    where MasterID = 1

) as a

where MasterID = 2

posted @ 2011-01-03 17:27  yangzhiqw  阅读(162)  评论(0编辑  收藏  举报