sql小技巧

--实际只会更新一条。可有效防止误操作、特别是操作线上正式数据时。

UPDATE TOP(1) Table2 SET Culumn1='value'
WHERE id IN(269102,269104)

 

 

<OrderKey>000000102153003,</OrderKey>
<OrderKey>000000102153337,</OrderKey>
<OrderKey>000000102153293,</OrderKey>
<OrderKey>000000102153411,</OrderKey>(若AS OrderKey 没有则直接以,相连)

SELECT '000000'+OrderId AS OrderKey
FROM Order
WHERE CreateDate>'2016-11-10'
FOR XML PATH('')

 

ISNULL(COLUMN,0)

SELECT OrderId,ISNULL(OrderFlag,0) AS OrderFlag  --给null列设置默认值0
FROM TCCLine.dbo.CLine_Order

 

posted on   nlh774  阅读(126)  评论(0编辑  收藏  举报

努力加载评论中...
点击右上角即可分享
微信分享提示