Navicat sql server关于数据库存储过程。
用存储过程的问题;清大家帮帮我,到底该怎么写;我想多表删除数据!CREATEPROCEDURE[dbo].[pr1_del_usertel]@usertelnvarcha...
用存储过程的问题;清大家帮帮我,到底该怎么写;我想多表删除数据!
CREATE PROCEDURE [dbo].[pr1_del_usertel]
@usertel nvarchar(20) --声明变量
AS
BEGIN
declare @sql varchar(1000)
IF(@usertel='' OR @usertel IS NULL)
BEGIN
SELECT '0' as 'message','请输入要删除的用户电话!' AS 'ErrorInfo'
RETURN
END
ELSE
BEGIN TRANSACTION
set @sql='delete from TBUserInfo where [User_Tel] in (' +@usertel+')'
SELECT '0' as 'message','删除成功!' AS 'ErrorInfo'
END
IF(@@ERROR<>0)
BEGIN
ROLLBACK TRANSACTION;
SELECT '0' as 'message','删除失败!' AS 'ErrorInfo'
RETURN
END COMMIT TRANSACTION;
END;(最后这个END;提示我[SQL Server]“;”附近有语法错误。)
存储过程也创建成功了。可是当我输入条件的时候并执行这条存储过程时,对应的条件信息并没有被删除!这是怎么回事? 展开
CREATE PROCEDURE [dbo].[pr1_del_usertel]
@usertel nvarchar(20) --声明变量
AS
BEGIN
declare @sql varchar(1000)
IF(@usertel='' OR @usertel IS NULL)
BEGIN
SELECT '0' as 'message','请输入要删除的用户电话!' AS 'ErrorInfo'
RETURN
END
ELSE
BEGIN TRANSACTION
set @sql='delete from TBUserInfo where [User_Tel] in (' +@usertel+')'
SELECT '0' as 'message','删除成功!' AS 'ErrorInfo'
END
IF(@@ERROR<>0)
BEGIN
ROLLBACK TRANSACTION;
SELECT '0' as 'message','删除失败!' AS 'ErrorInfo'
RETURN
END COMMIT TRANSACTION;
END;(最后这个END;提示我[SQL Server]“;”附近有语法错误。)
存储过程也创建成功了。可是当我输入条件的时候并执行这条存储过程时,对应的条件信息并没有被删除!这是怎么回事? 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |