Heim  >  Artikel  >  Datenbank  >  SQL的小常识, 备忘之用, 慢慢补充.

SQL的小常识, 备忘之用, 慢慢补充.

WBOY
WBOYOriginal
2016-06-07 18:03:51794Durchsuche

SQL的小常识, 备忘之用, 慢慢补充.

1. @@rowcount: 获取受影响行数
代码如下:
update SNS_TopicData set TopicCount=TopicCount+1 where Topic ='1'
if @@rowcount>0
begin
print '成功'
end
else
begin
print '失败'
end

2.存储过程的调用
代码如下:
--申明返回变量
declare @topicCount int
--执行
EXEC [SNS_TopicData_BlogAdd]
--返回值设置
@topicCount output,
--参数传入
@topic='huati'
--输出返回值
PRINT @topicCount

3. 不锁表 with(nolock)
代码如下:
SELECT * FROM SNS_TopicData WITH(nolock)

原文:http://www.cnblogs.com/henw/archive/2011/10/18/2216593.html
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn