[TITeye - 威尼斯人

[TITeye

2019-01-11 06:49:51 | 作者: 盼菡 | 标签: 字典,目标,脚本 | 浏览: 2675

/****** 目标: Table [dbo].[WZOU_SysPermission] 脚本日期: 10/28/2014 11:05:41 ******/ SET ANSI_NULLS ON SET QUOTED_IDENTIFIER ON CREATE TABLE [dbo].[WZOU_SysPermission]( [TeacherId] [nchar](8) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, [Specialty] [nvarchar](16) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, [ClassName] [nvarchar](16) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, [Permission] [bigint] NOT NULL, [Remark] [nvarchar](512) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, CONSTRAINT [PK_WZOU_SysPermission] PRIMARY KEY CLUSTERED [TeacherId] ASC, [Specialty] ASC, [ClassName] ASC )WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY] ) ON [PRIMARY] EXEC sys.sp_addextendedproperty @name=NMS_Description, @value=N教师编号 , @level0type=NSCHEMA,@level0name=Ndbo, @level1type=NTABLE,@level1name=NWZOU_SysPermission, @level2type=NCOLUMN,@level2name=NTeacherId EXEC sys.sp_addextendedproperty @name=NMS_Description, @value=N专业(字典库 DicType=05) , @level0type=NSCHEMA,@level0name=Ndbo, @level1type=NTABLE,@level1name=NWZOU_SysPermission, @level2type=NCOLUMN,@level2name=NSpecialty EXEC sys.sp_addextendedproperty @name=NMS_Description, @value=N班级(字典库 DicType=07) , @level0type=NSCHEMA,@level0name=Ndbo, @level1type=NTABLE,@level1name=NWZOU_SysPermission, @level2type=NCOLUMN,@level2name=NClassName EXEC sys.sp_addextendedproperty @name=NMS_Description, @value=N权限字段 , @level0type=NSCHEMA,@level0name=Ndbo, @level1type=NTABLE,@level1name=NWZOU_SysPermission, @level2type=NCOLUMN,@level2name=NPermission EXEC sys.sp_addextendedproperty @name=NMS_Description, @value=N补白 , @level0type=NSCHEMA,@level0name=Ndbo, @level1type=NTABLE,@level1name=NWZOU_SysPermission, @level2type=NCOLUMN,@level2name=NRemark

set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
-- =============================================
-- Author: Author,,Name 
-- Create date: Create Date,, 
-- Description: Description,, 
-- =============================================
CREATEPROCEDURE [dbo].[UpdateSysPermission]
 -- Add the parameters for the stored procedure here
 @TeacherId nchar(8),
 @Specialty nvarchar(16),
 @ClassName nvarchar(16),
 @Permission bigint,
 @Remark nvarchar(512) = 
BEGIN
 DECLARE @StrSQL NVARCHAR(2000)
 DECLARE @Count int
 SELECT @Count=count(*) FROM WZOU_SysPermission WHERE TeacherId=@TeacherId AND Specialty=@Specialty AND ClassName=@ClassName 
 SET @StrSQL = SELECT * FROM WZOU_SysPermission WHERE TeacherId = N + @TeacherId +  AND Specialty = N+ @Specialty + AND ClassName = N + @ClassName 
 PRINT(@Count)
 IF EXISTS(SELECT * FROM WZOU_SysPermission WHERE TeacherId=@TeacherId AND Specialty=@Specialty AND ClassName=@ClassName)
 BEGIN
 PRINT(@StrSQL)
 END 
 IF (@Count = 0)
 BEGIN
 SET @StrSQL = INSERT INTO WZOU_SysPermission (TeacherId, Specialty, ClassName, Permission, Remark) VALUES(N + @TeacherId + , N + @Specialty + , N + @ClassName + ,  + convert(nvarchar,@Permission) + , N + @Remark + )
 ELSE
 BEGIN
 SET @StrSQL = UPDATE WZOU_SysPermission SET Permission =  + convert(nvarchar,@Permission) + , Remark = N + @Remark +  WHERE (TeacherId = N + @TeacherId +  AND Specialty = N + @Specialty +  AND ClassName = N + @ClassName + )
 PRINT(@StrSQL) 
 EXEC(@StrSQL)



UpdateSysPermission @TeacherId=00000000,@Specialty=N管帐,@ClassName=N1班,@Permission= 3
版权声明
本文来源于网络,版权归原作者所有,其内容与观点不代表威尼斯人立场。转载文章仅为传播更有价值的信息,如采编人员采编有误或者版权原因,请与我们联系,我们核实后立即修改或删除。

猜您喜欢的文章

阅读排行

  • 1

    RAC的Diskgroup重建ITeye

    磁盘,重建,数据库
  • 2

    Switch to UTFITeye

    编码,设置,文件
  • 3

    pl/sql使用之使用utlITeye

    文件,办法,输出
  • 4
  • 5

    (转)in 和 existITeye

    分区,查询,一个
  • 6

    oracle正则表达式ITeye

    正则表达式,匹配,表达式
  • 7

    SQL句子的优化办法ITeye

    优化,例如,句子
  • 8
  • 9

    Oracle 存储进程的运用ITeye

    存储,进程,参数
  • 10

    Oracle替换表空间ITeye

    空间,新表,包括