472,122 Members | 1,572 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,122 software developers and data experts.

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 1543

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
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.