CREATE PROCEDURE forums_DisallowedName_CreateUpdateDelete
(
@Name nvarchar(64),
@Replacement nvarchar(64),
@DeleteName bit = 0
)
AS
SET NOCOUNT ON
-- 上面一句的作用是‘使返回的结果中不包含有关受 Transact-SQL 语句影响的行数的信息。’,是不是可以理解为:@@ROWCOUNT将返回零
if( @DeleteName > 0 )
BEGIN
DELETE FROM
forums_DisallowedNames
WHERE
DisallowedName = @Name
END
ELSE
BEGIN
UPDATE forums_DisallowedNames SET
DisallowedName = @Replacement
WHERE
DisallowedName = @Name
if( @@rowcount = 0 )
-- 如果我上面的理解正确的话,那上面那IF里的表达式不是恒真?
(
@Name nvarchar(64),
@Replacement nvarchar(64),
@DeleteName bit = 0
)
AS
SET NOCOUNT ON
-- 上面一句的作用是‘使返回的结果中不包含有关受 Transact-SQL 语句影响的行数的信息。’,是不是可以理解为:@@ROWCOUNT将返回零
if( @DeleteName > 0 )
BEGIN
DELETE FROM
forums_DisallowedNames
WHERE
DisallowedName = @Name
END
ELSE
BEGIN
UPDATE forums_DisallowedNames SET
DisallowedName = @Replacement
WHERE
DisallowedName = @Name
if( @@rowcount = 0 )
-- 如果我上面的理解正确的话,那上面那IF里的表达式不是恒真?
-- 如果我上面的理解不正确的话,那 SET NOCOUNT ON的真正作用是什么呢?
BEGIN
INSERT INTO forums_DisallowedNames (
DisallowedName
) VALUES (
@Name
)
END
END
GO
BEGIN
INSERT INTO forums_DisallowedNames (
DisallowedName
) VALUES (
@Name
)
END
END
GO