有没有办法知道我的 SQL SERVER DB 2014 中的兼容性级别是否已更改?
我需要你的帮助,我需要一些指导来提高以下给定视图的性能。
我有一个用以下代码编写的视图:
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)