#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 连接抛出“无法使用旧的不安全身份验证连接到 MySQL 4.1+"来自 XAMPP 的错误 2022-01-01
- 使用 Oracle PL/SQL developer 生成测试数据 2021-01-01
- 在SQL中,如何为每个组选择前2行 2021-01-01
- 导入具有可变标题的 Excel 文件 2021-01-01
- 如何将 SonarQube 6.7 从 MySQL 迁移到 postgresql 2022-01-01
- SQL 临时表问题 2022-01-01
- 如何将 Byte[] 插入 SQL Server VARBINARY 列 2021-01-01
- 以一个值为轴心,但将一行上的数据按另一行分组? 2022-01-01
- 更改自动增量起始编号? 2021-01-01
- 如何使用 pip 安装 Python MySQLdb 模块? 2021-01-01
