表值函数和标值函数使用脚本范例
来源:互联网 发布:php考试系统手机端 编辑:程序博客网 时间:2024/04/30 20:02
select * from authors--多语句表值函数use pubsgocreate function fuc_authors()returns @table_author_temp table( au_id smallint, ai_lname varchar(40))asbegin insert into @table_author_temp select au_id,au_lname from authors returnenddrop function fuc_authorsexec sp_helptext fuc_authorsalter function fuc_authors( @fname varchar(20)='Dean') returns @table_author_temp table ( au_id varchar(40), au_lname varchar(40) ) as begin insert into @table_author_temp select au_id,au_lname from authors where au_fname=@fname return endgo select * from fuc_authors(default)--内联表值函数create function inline_fuc_authors( @fname varchar(20)='Dean')returns tableasreturn( select au_id,au_lname from authors where au_fname=@fname)goselect * from dbo.inline_fuc_authors(default)drop function inline_fuc_authors--标量值函数create function scalar_fuc_authors( @fname varchar(40)='Dean')returns varcharasbegin declare @ret varchar(40) set @ret=(select au_id from authors where au_fname=@fname) return @retendgoalter function scalar_fuc_authors( @fname varchar(40)='Dean')returns varchar(40)asbegin declare @ret varchar(40) set @ret=(select au_id from authors where au_fname=@fname) return @retendgo--此处执行一定要添加架构名‘dbo.’select dbo.scalar_fuc_authors('White')
0 0
- 表值函数和标值函数使用脚本范例
- 字符测试函数使用范例
- VC++ webbrowser函数使用范例
- VC++ webbrowser函数使用范例
- VC++ webbrowser函数使用范例
- VC++ webbrowser函数使用范例
- Golang模板函数使用范例
- 多参数sp_executesql 函数的使用范例
- C++成员函数指针的使用范例
- c语言函数指针使用范例
- MySQL CASE/REPLACE/EXISTS函数使用范例
- erlang函数说明及使用范例
- Linux socket 基础函数及使用范例
- shell脚本:函数使用
- 脚本调试和函数
- 函数的范例
- shell脚本里函数定义和变量使用
- Ecshop JS脚本引入方法insert_scripts函数使用和新增
- View工作原理【动画概述】
- boost源码剖析之:泛型函数指针类
- Blender 的使用
- poj-1362
- 签证办理让人欢喜让人忧
- 表值函数和标值函数使用脚本范例
- Linux动态库相关的注意事项
- 信安绿色生活圈,单身汉的幸福选择!
- 计算机视觉、机器学习相关领域论文和源代码大集合--持续更新……
- shell学习之< 和 > 差在哪?
- 带树有向图的关键路径
- 白话经典算法系列之四 直接选择排序及交换二个数据的正确实现
- VB API
- 将安卓源码导入到eclipse中