zoukankan      html  css  js  c++  java
  • 存储过程

    --存储过程(在数据库的可编程性里面)

    create proc chaxun
    as
    begin
     select *from student
    end
    go
    --执行
    exec chaxun
    --删除
    drop proc chaxun
    --修改
    alter proc chaxun
    as
    begin
     select *from hj
    end
    go

    /*=====================输入一个数,求这个数的阶乘的和=====================*/
    create proc jiechenghe
    @p int,@w int output,@h int output    --output导出参数时使用
    as
    begin
         declare @s int
         set @w=1
         set @s=1
         set @h=0
         while @s<=@p       --while 代表循环的意思
               begin
                 set @w=@s*@w
                 set @s=@s+1
                 set @h=@h+@w
               end
    end
    go
    declare @c int,@c1 int                --新建函数是为了导出参数使用的
    exec jiechenghe 6,@c output,@c1 output
    print @c             --print输出结果
    print @c1

    //return 也是导出参数但是只能导出一个参数且表达方式是int型的

  • 相关阅读:
    关于图片去水印和转载
    多叉树(森林)转二叉树
    [置顶] 读入优化&输出优化
    【NOI OJ】1816 拨钟问题
    Splay树
    【AVL】宠物收养所
    【树状数组】Stars
    对拍
    使用Mybatis进行多表联查操作
    搜索框自动提示
  • 原文地址:https://www.cnblogs.com/2041388565m/p/4135749.html
Copyright © 2011-2022 走看看