私は次のspを構築しようとしています:
USE [MarMoniApp]
GO
/****** Object: StoredProcedure [dbo].[Desc_by_date] Script Date: 10/23/2012 09:01:40 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[Desc_by_date]
@DateToSearch varchar(50)
AS
BEGIN
select a.ticker,a.First_T, a.Last_T, a.Size_mln, a.pct_d_vol,a.a_trad,a.coolname,a.recency,b.Analyst
from Order_Desc a
CASE
When a.coolname = 'ELTORO'
then (Inner join MarMoniApp.dbo.Namelist b on a.ticker = b.ticker )
END
where convert(datetime, cast(rtrim(First_T) AS nvarchar)) > DateToSearch
order by CONVERT(DATETIME, cast(rtrim(First_T) AS nvarchar) ) DESC
END
「coolname」がeltoroと等しい場合にのみ内部結合を実行したいのですが、構文が正しくないようです。