469,126 Members | 1,312 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,126 developers. It's quick & easy.

Cross / Outer Apply

I am passing a bunch of parameters to my stored proc. The following query uses a few of those parameters alongwith a column value from the outer table using cross apply. I get a compilation error "Incorrect Syntax near B1". this is in the From Clause. Please note that it is the last parameter in the function call

Expand|Select|Wrap|Line Numbers
  1. SELECT 
  2.              ContractId = @ContractId, BusinessUnitId = B1.BusinessUnitId, B1.ServiceId, B1.CampaignId, 
  3.               TotalCount = F1.TotalCount,            
  4.               EligibleCount = F1.EligibleCount,
  5.               UnitPrice = F1.UnitRate,
  6.               TotalPrice = Convert(decimal(20,10),0.00),
  7.               BusinessUnitExpenseId = NULL,
  8.               IsFixed = CONVERT(bit,'False'),
  9.               FixedAmtDealType = CONVERT(varchar(3),''),
  10.              ShowFixedAmtDealType  = @ShowFixedAmountWithDealType
  11. INTO 
  12.               #TempAccountDetails 
  13. FROM            
  14.               BusinessUnitAccountingSummaryData AS B1 
  15.               CROSS APPLY dbo.func_GetServiceContractFigures(@StartDate, @EndDate, @Service, @BUId, B1.CampaignId) AS F1            
  16. WHERE
  17.               B1.ServiceId = @Service
  18.               AND B1.BusinessUnitId = @BUId
  19.               AND B1.Date BETWEEN @ContractStartDate AND @ContractEndDate            
  20. GROUP BY B1.ServiceId, B1.CampaignId, B1.BusinessUnitId
Mar 26 '08 #1
0 1500

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by Henry J. | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by Mortomer39 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.