Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
tokue
Starting Member
16 Posts |
Posted - 2011-05-13 : 22:14:50
|
How can I update a record and select it at the same time, the table (message) has three fields (ID, messageText, isRead), I want a single query which returns messageText and the same time set isRead =1, is this possible? |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2011-05-13 : 22:45:54
|
[code]update tset isRead = 1output inserted.messageTextfrom yourtable twhere ID = @ID[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
tokue
Starting Member
16 Posts |
Posted - 2011-05-13 : 23:02:29
|
Dear khtan, Thanks a lot |
 |
|
|
|
|