SQL 存储过程(添加,修改)

SQL 存储过程(添加,修改)
 1 /****** 对象:  StoredProcedure [dbo].[SLS_LT_TeamManager_Common]    ******/
 2 SET ANSI_NULLS ON
 3 GO
 4 SET QUOTED_IDENTIFIER ON
 5 GO
 6 /*
 7 --用途说明:信息(添加,修改)
 8 --创建用户:lgw
 9 --创建时间:2014-01-26
10 */
11 CREATE PROCEDURE [dbo].[SLS_LT_TeamManager_Common]
12 (
13 @Id int,
14 @TeamNo varchar(50),
15 @TeamName varchar(50),
16 @TeamUserName varchar(20),
17 @TeamPwd varchar(50),
18 @TeamPhone varchar(20),
19 @TeamCode varchar(50),
20 @CreateUser varchar(50),
21 @CreateIp varchar(50)
22 )
23 AS
24 BEGIN
25     --变量
26     DECLARE @Des varchar(500)
27     SET @Des=‘‘
28     --开始事务--
29     BEGIN TRAN
30     IF @Id=0
31     BEGIN
32         INSERT INTO SLS_LT_TeamManager(TeamNo,TeamName,TeamUserName,TeamPwd,TeamPhone,TeamCode)
33         VALUES(@TeamNo,@TeamName,@TeamUserName,@TeamPwd,@TeamPhone,@TeamCode)
34         IF @@ERROR<>0 OR @@ROWCOUNT<>1
35         BEGIN
36             SELECT -1 AS RetNo,添加信息操作失败 AS RetMsg
37             ROLLBACK TRAN
38             RETURN 
39         END
40         set @Des = 添加团队经理(lt)信息,经理ID[ + @TeamNo+]
41     END
42     ELSE
43     BEGIN
44         UPDATE SLS_LT_TeamManager SET
45         TeamNo=@TeamNo,TeamName=@TeamName,TeamUserName=@TeamUserName,TeamPwd=@TeamPwd,TeamPhone=@TeamPhone,TeamCode=@TeamCode
46         WHERE Id=@Id
47         IF @@ERROR<>0 OR @@ROWCOUNT<>1
48         BEGIN
49             SELECT -2 AS RetNo,保存信息操作失败 AS RetMsg
50             ROLLBACK TRAN
51             RETURN 
52         END
53         SET @Des=修改团队经理(lt)信息,经理ID[+@TeamNo+]
54     END
55 
56     --添加日志
57     --EXEC 
58     --IF @@ERROR<>0
59     --BEGIN
60     --    SELECT ‘-3‘ AS RetNo, ‘日志保存操作失败‘ AS RetMsg 
61     --    ROLLBACK TRAN
62     --    return
63     --END
64 
65     select 1 as RetNo,操作成功 as RetMsg
66     COMMIT TRAN
67 END
SQL 存储过程(添加,修改)

SQL 存储过程(添加,修改)

上一篇:Photoshop 网页布局设计的关系


下一篇:如何让小眼睛变大?ps制作大眼睛教程