#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 聚合
创建聚合
这篇关于用户定义函数的“表达式"参数数据类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:用户定义函数的“表达式"参数数据类型
基础教程推荐
- 需要 MySQL 5.1 中的抽象触发器来更新审计日志 2021-01-01
- SSMS 中的权限问题:“对象 'extended_properties'、数据库 'mssqlsystem_resource'、... 错误 229)上的 SELECT 权限被拒绝" 2022-01-01
- SQL:使用来自具有相同列名的两个表中的数据... 2021-01-01
- 在 SQL 中连接多个表 2021-01-01
- 如何使用 mysql.connector 禁用查询缓存 2022-01-01
- 将 SQL Server DateTime 列迁移到 DateTimeOffset 2021-01-01
- SQL 效率:WHERE IN 子查询 vs. JOIN 然后 GROUP 2021-01-01
- 无法解决整理冲突 2021-01-01
- 是否可以执行按位分组功能? 2021-01-01
- SQL Server 实例在登录协商期间返回无效或不受支持的协议版本 2021-01-01
