how can I Update top 100 records in sql server

前端 未结 7 1237
醉梦人生
醉梦人生 2020-11-27 10:03

I want to update the top 100 records in SQL Server. I have a table T1 with fields F1 and F2. T1 has 200 records. I want

7条回答
  •  北荒
    北荒 (楼主)
    2020-11-27 10:21

    Try:

    UPDATE Dispatch_Post
    SET isSync = 1
    WHERE ChallanNo 
    IN (SELECT TOP 1000 ChallanNo FROM dbo.Dispatch_Post ORDER BY 
    CreatedDate DESC)
    

提交回复
热议问题