zoukankan      html  css  js  c++  java
  • SQL Server2008 1

    多表触发器
    create trigger trg_a
    on a表
    for update
    as
    declare @xmbh varchar(10)
    select @xmbh=项目编号 from updated
    declare @xmmc varchar(50)
    select @xmmc=项目名称 from updated
    update B表 set 项目名称=@xmmc where 项目编号=@xmbh
    update c表 set 项目名称=@xmmc where 任务书编号=@xmbh
    go
    
    
    
    两表相关联的视图
    CREATE VIEW dbo.VIEW3
    AS
    SELECT dbo.info.*, dbo.login.name AS 姓名, dbo.login.password AS 密码
    FROM dbo.info INNER JOIN
          dbo.login ON dbo.info.id = dbo.login.id
    
    
    
    
    
    
    
    
    declare @did char(3)
        declare @faly char(1)
        declare @employeeid char(6)    
        declare @name char(10)
        declare @birthday datetime
        declare @sex char(2)
        update  updated set @employeeid=employeeid
        select @did=departmentid  from Inserted
        select @faly='1'  from departments where departmentid=@did
    if @faly='1'
    begin
    insert into employees(employeeid,name,birthday,sex,departmentid) values(@employeeid,@name,@birthday,@sex,@did)
    end
    else
    begin
    rollback
    end
  • 相关阅读:
    解决iex -S mix报错
    OTP服务器
    多进程
    字符串与二进制
    IphoneX适配正确姿势
    Babel 配置用法解析
    babel版本变化
    你好,babel
    XSS攻击 && CSRF攻击 基础理解
    小程序开发初体验~
  • 原文地址:https://www.cnblogs.com/qiushuixizhao/p/3138956.html
Copyright © 2011-2022 走看看