By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,363 Members | 2,440 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,363 IT Pros & Developers. It's quick & easy.

Cross / Outer Apply

P: 1
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
Share this question for a faster answer!
Share on Google+

Post your reply

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