--
SET ROWCOUNT 1 /*要先下此條件*/ GO UPDATE table_name set field_1 = GETDATE()WHERE field_2 = 'Y'
另一個方法(20140227):
UPDATE note
SET picture=@picture
WHERE user_id=@userid AND no=(SELECT TOP 1 no FROM note WHERE user_id=@userid ORDER BY no DESC)
或
UPDATE note
SET picture=@picture
WHERE user_id=@userid AND no=(SELECT max(no) FROM note WHERE user_id=@userid)
沒有留言:
張貼留言