sql 增加文章点击数 怎么做

来源:百度知道 编辑:UC知道 时间:2024/05/30 05:21:17
update article set hit = hit+1 where id=5
如果我想在执行sql语句的同时 返回hit 的值 该怎么做 谢谢!尽量不要用存储过程。

update article set hit = hit+1 where id=5

select hit from article where id = 5

go

@hit 类型 output
as
update article set hit = hit+1 where id=5

select @hit=[hit] from article where id = 5

go
这是用变量传

更新好后,再把要的内容查询出来,然后用一个变量取过来,传到要显示的页面中去就好了