#39;Expression#39; parameter data types for user-defined functions(用户定义函数的“表达式参数数据类型)
问题描述
我正在尝试创建一个将 表达式作为参数的函数
I am trying to create a function that takes as a parameter an expression like what is used with BINARY_CHECKSUM. Specifically, I want my parameter to be a list of 1 to N column names. When I look at the definition of BINARY_CHECKSUM (or MAX or CHECKSUM for that matter) in Object Explorer in SQL Server Management Studio the parameter is defined as 'Expression (any type)'- can a user-defined function emulate this? I know that I could use a parameter a delimited list of comma names, but I'm curious about 'Expression (any type)'.
推荐答案
如果您想在 SQL 中编写自己的聚合函数(例如 BINARY_CHECKSUM、COUNT 等)Server 2005 或更高版本,您将不得不使用 CLR.请参阅 MSDN 上的以下内容:
If you want to write your own aggregate functions (like BINARY_CHECKSUM, COUNT, etc) in SQL Server 2005 or later, you'll have to use the CLR. See the following on MSDN:
如何:创建和运行 CLRSQL Server 聚合
创建聚合
这篇关于用户定义函数的“表达式"参数数据类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:用户定义函数的“表达式"参数数据类型
基础教程推荐
- 如何在 SQL 中将 Float 转换为 Varchar 2021-01-01
- oracle区分大小写的原因? 2021-01-01
- 二进制文件到 SQL 数据库 Apache Camel 2021-01-01
- 什么是 orradiag_<user>文件夹? 2022-01-01
- 如何根据该 XML 中的值更新 SQL 中的 XML 2021-01-01
- 表 './mysql/proc' 被标记为崩溃,应该修复 2022-01-01
- 在多列上分布任意行 2021-01-01
- mysql选择动态行值作为列名,另一列作为值 2021-01-01
- 在 MySQL 中:如何将表名作为存储过程和/或函数参数传递? 2021-01-01
- MySQL 中的类型:BigInt(20) 与 Int(20) 2021-01-01
