只有函数和某些扩展存储过程才能从函数内部执行
2017-09-01 10:36
369 查看
The types of statements that are valid in a function include:
DECLARE statements can be used to define data variables and cursors that are local to the function.
Assignments of values to objects local to the function, such as using SET to assign values to scalar and table local variables.
Cursor operations that reference local cursors that are declared, opened, closed, and deallocated in the function. FETCH statements that return data to the client are not allowed. Only FETCH statements that assign values to local variables using the INTO clause are allowed.
Control-of-flow statements.
SELECT statements containing select lists with expressions that assign values to variables that are local to the function.
UPDATE, INSERT, and DELETE statements modifying table variables that are local to the function.
EXECUTE statements calling an extended stored procedure.
The number of times that a function specified in a query is actually executed can vary between execution plans built by the optimizer. An example is a function invoked by a subquery in a WHERE clause. The number of times the subquery and its function is executed can vary with different access paths chosen by the optimizer.
Built-in functions that can return different data on each call are not allowed in user-defined functions. The built-in functions not allowed in user-defined functions are:
@@CONNECTIONS @@PACK_SENT GETDATE
@@CPU_BUSY @@PACKET_ERRORS GetUTCDate
@@IDLE @@TIMETICKS NEWID
@@IO_BUSY @@TOTAL_ERRORS RAND
@@MAX_CONNECTIONS @@TOTAL_READ TEXTPTR
@@PACK_RECEIVED @@TOTAL_WRITE
DECLARE statements can be used to define data variables and cursors that are local to the function.
Assignments of values to objects local to the function, such as using SET to assign values to scalar and table local variables.
Cursor operations that reference local cursors that are declared, opened, closed, and deallocated in the function. FETCH statements that return data to the client are not allowed. Only FETCH statements that assign values to local variables using the INTO clause are allowed.
Control-of-flow statements.
SELECT statements containing select lists with expressions that assign values to variables that are local to the function.
UPDATE, INSERT, and DELETE statements modifying table variables that are local to the function.
EXECUTE statements calling an extended stored procedure.
The number of times that a function specified in a query is actually executed can vary between execution plans built by the optimizer. An example is a function invoked by a subquery in a WHERE clause. The number of times the subquery and its function is executed can vary with different access paths chosen by the optimizer.
Built-in functions that can return different data on each call are not allowed in user-defined functions. The built-in functions not allowed in user-defined functions are:
@@CONNECTIONS @@PACK_SENT GETDATE
@@CPU_BUSY @@PACKET_ERRORS GetUTCDate
@@IDLE @@TIMETICKS NEWID
@@IO_BUSY @@TOTAL_ERRORS RAND
@@MAX_CONNECTIONS @@TOTAL_READ TEXTPTR
@@PACK_RECEIVED @@TOTAL_WRITE
相关文章推荐
- sqlserver 只有函数和扩展存储过程才能从函数内部执行
- 数据库小知识正在执行的存储过程和函数
- dbvisualizer客户端执行存储过程和函数(方法)注意事项
- VB6:编写一个分析sqlserver存储过程执行语句"execute procedurename par1,par2,......."语法是否正确的函数
- [VB.NET]点net写client程序传递参数给mssql存储过程insert,为什么要反复执行客户端代码才能成功insert,怎么才能使客户端插入记录操作变得稳定呢?
- Java代码中执行存储过程和函数
- Oracle 在函数或存储过程中执行一条插入语句并返回主键ID值
- .net 执行oracle存储过程时 找不到存储过程名,总是找函数的原因
- Java中执行存储过程和函数
- SQL2000系统表、存储过程、函数的功能介绍及应用2009年01月21日 星期三 11:38虽然使用系统存储过程、系统函数与信息架构视图已经可以为我们提供了相当丰富的元数据信息,但是对于某些特殊的元数据信息,我们仍然需要直接对系统表进行查询。因为SQL
- Java中执行存储过程和函数(web基础学习笔记十四)
- 执行海量数据存储过程的函数方法
- Java中执行存储过程和函数
- SQL Server 第四堂课,创建存储过程。存储过程是一组编译在单个执行计划中的transact-SQL语句。存储过程相当于C#函数,可以允许模块化程序设计,允许更快执行如果某操作需要大量transct-SQL代码或需要重复执行,将在创建存储过程中对其进行分析和优化。
- Oracle 在函数或存储过程中执行sql查询字符串并将结果值赋值给变量
- Oracle.DataAccess.Client.OracleException ORA-00600: 内部错误代码,通过C#执行上面存储过程报错,而通过PLSQL执行不报错。谁知道原因。
- 存储过程和函数的执行方法
- 存储过程、存储函数、内部函数三者的区别与联系
- 链接服务器遇到某些存储过程不能执行的问题
- .net 执行oracle存储过程时 找不到存储过程名,总是找函数的原因