小编gia*_*cum的帖子

SQL Server 的兼容级别

有没有办法知道我的 SQL SERVER DB 2014 中的兼容性级别是否已更改?

sql-server sql-server-2014 cardinality-estimates

5
推荐指数
1
解决办法
908
查看次数

SQL Server:使用 case 语句提高 CTE 性能

我需要你的帮助,我需要一些指导来提高以下给定视图的性能。

我有一个用以下代码编写的视图:

with timeframes  as
(
select p.SEARCH_NUM, 
case   when p.FROM_DATE is not null then p.FROM_DATE
       when p.FROM_DATE is null and P.SEARCH_DAYS is not null and p.TO_DATE is not null then DATEADD(day,p.SEARCH_DAYS*-1,p.TO_DATE)
       when p.FROM_DATE is null and P.SEARCH_DAYS is not null and p.TO_DATE is null then DATEADD(day,p.SEARCH_DAYS*-1,GetDate()) 
       when p.FROM_DATE is null and P.SEARCH_DAYS is null and p.TO_DATE is not null and p.DURATION = 'Yearly' then DATEADD(year,-1,p.TO_DATE)
       when p.FROM_DATE is null and P.SEARCH_DAYS is null and p.TO_DATE is null and p.DURATION …
Run Code Online (Sandbox Code Playgroud)

performance cte execution-plan view sql-server-2012

1
推荐指数
1
解决办法
5206
查看次数