我需要這個視圖,但它似乎你不能使用聲明。 有幫助嗎?聲明的SQL視圖
declare @lastsat datetime
set @lastsat =
(select max(fechahoy) from [BigArea].[Thing].[Expanded] where DiaSemana='Saturday')
SELECT a.*,
case
when b.fecha_gestion = a.fechahoy and month(fechahoy)!=month(getdate()) then 1
when a.fechahoy = @lastsat then 1
else 0
end as FinDeMEs
FROM [BigArea].[Thing].[Expanded] a
join [BigArea].[dbo].[fechas_gestion] b
on a.fechahoy = b.fecha
根據T-SQL的用法和非標準引用添加了'sql-server'標籤'[..]' –
你可能不應該公開地發佈模式,包括用戶名和類似.... – Dan