聚合函数 (Entity SQL)
SQL Server .NET Framework 数据提供程序 (SqlClient) 提供聚合函数。聚合函数对一组输入值执行计算并返回一个值。这些函数位于 SqlServer 命名空间中,该命名空间在您使用 SqlClient 时可用。提供程序的命名空间属性使实体框架可以确定此提供程序对特定构造(如类型和函数)使用哪个前缀。
下表显示 SqlClient 聚合函数。
函数 说明
AVG( expression )
返回集合中各值的平均值。
将忽略 Null 值。
参数
Int32、 Int64、Double 和 Decimal。
返回值
expression 的类型。
示例
SELECT VALUE SqlServer.AVG(p.ListPrice) from
AdventureWorksEntities.Product as p
CHECKSUM_AGG( collection )
返回集合中各值的校验和。
将忽略 Null 值。
参数
集合 (Int32)。
返回值
Int32。
示例
SELECT VALUE SqlServer.Checksum_Agg(cast(product.ListPrice as Int32))
from AdventureWorksEntities.Product AS product
where product.ListPrice > cast(2.0 as Decimal)
COUNT( expression )
以 Int32 形式返回集合中的项数。
参数
集合 (T),其中 T 为以下类型之一:
Guid(在 SQL Server 2000 中不返回)、
Boolean、Double、DateTime、DateTimeOffset、Time、String 或 Binary。
返回值
Int32。
示例
anyelement(SELECT VALUE SqlServer.COUNT(product.ProductID)
from AdventureWorksEntities.Product AS product
WHERE SqlServer.CEILING(product.ListPrice) ==
SqlServer.FLOOR(product.ListPrice))
COUNT_BIG( expression )
以 bigint 形式返回集合中的项数。
参数
集合 (T),其中 T 为以下类型之一:
Guid(在 SQL Server 2000 中不返回)、Boolean、Double、DateTime、DateTimeOffset、Time、String 或 Binary。
返回值
Int64。
示例
SELECT VALUE SqlServer.COUNT_BIG(product.ProductID)
from AdventureWorksEntities.Product AS product
WHERE SqlServer.CEILING(product.ListPrice) ==
SqlServer.FLOOR(product.ListPrice)
MAX( expression )
返回集合中的最大值。
参数
集合 (T),其中 T 为以下类型之一:Byte、Int16、Int32、Int64、Byte、Single、Double、Decimal、DateTime、DateTimeOffset、Time、String、Binary。
返回值
expression 的类型。
示例
SELECT VALUE SqlServer.MAX(p.ListPrice)
from AdventureWorksEntities.Product as p
MIN(
相关文档:
set autotrace off
set autotrace on
set autotrace traceonly
set autotrace on explain
set autotrace on statistics
set autotrace on explain statistics
set autotrace traceonly explain
set ......
father表 son表
fid fname sid sname fid height money
1 a 100 s1 1 1.7 7000
2 b 101 s2 2 1.6 8000
3 c 102&nbs ......
--行列互转
/******************************************************************************************************************************************************
以学生成绩为例子,比较形象易懂
整理人:中国风(Roy)
日期:2008.06.06
***************************************************************** ......
先把程序打开,菜单上 Environment/Examples/Performance Examples 在空白处输入
要执行的程序,注意一定要正确,否则后果很严重,呵呵.
data: itab type table of TRDIR with header line.
select * from TRDIR into table itab
where NAME = 'ZHRRPT1011'.
read table itab with key name = 'ZHRRPT1011'.
......
Creating a Sample Installation that Creates a SQL Server Database by Running Customized SQL Script
InstallShield 2009
用自定义的SQL脚本创建SQL Server数据库安装例子
Project 项目
This information applies to the following project types: 此信息是用于下面的项目类型
• Basic MSI
&b ......