USE [PATEST]
GO
/****** Object: StoredProcedure [dbo].[ndform5queryforxml] Script Date: 12/22/2010 09:03:12 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: cculwell
-- Create date: 10/29/10
-- Description: nd form 5 query
-- =============================================
ALTER PROCEDURE [dbo].[ndform5queryforxml]
-- Add the parameters for the stored procedure here
@YearMonth VARCHAR(20) = ''
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
SELECT [dbo].[ufn.GetWellSummaryInformation] ( [WellID], [YrMonth], [AllocBegInventory], [AllocEndInventory], [AllocOil], [DaysOn],
[AllocOilSold], [AllocOilUsed], [AllocWater] )FROM [dbo].[ufn.GetWellSummaryInformation] AS [WellID], [YrMonth], [AllocBegInventory], [AllocEndInventory], [AllocOil], [DaysOn],
[AllocOilSold], [AllocOilUsed], [AllocWater] where (wellid is Not null)
-- Insert statements for procedure here
SELECT Company_Info.Name as CompName, Co_Info.ContactStreet as CompAddress,Co_Info.ContactSuite as CompSuite, Company_Info.City as CompCity, Company_Info.State as CompState, Company_Info.Zip as CompZip, Co_Info.CompanyID as Company,Co_Info.ContactFirstName as ContactfirstName,Co_Info.ContactLastName as ContactlastName, Co_Info.ContactPhone as ContactPhone, Co_Info.ContactTitle as ContactTitle, Co_Info.RptAmend as facAmend, Co_Info.RptComment as FacComment, Wells.APICode as FacId, Well_Summary.YearMonth as facreport, Co_Info.RptFacType as FacType, Wells.UserField9 as FacFormation, Wells.WellName as FacName, Wells.Status as FacGroup, Co_Info.RptProdType as ProdType, round(Well_Summary.AllocBegInventory,0) as prodbeginv,
round(Well_Summary.AllocEndInventory,0) as prodendinv,Co_Info.RptUnits as produnits, round(Well_Summary.AllocOil,0) as prodquantity, Well_Summary.DaysOn as proddaysproducing, Co_Info.RptDispType1 as disptype, round(Well_Summary.AllocOilSold,0) as oilsolddispqty, Co_Info.RptDispType2 disptype2,
round(Well_Summary.AllocOilSold,0) as dispquantity2, Co_Info.RptDispType3 as disptype3, round(Well_Summary.AllocOilUsed,0) as dispquantity3, Co_Info.RptProdType1 as prodtype1, Co_Info.RptUnits as produnits1, round(Well_Summary.AllocWater,0) as waterprodqty,.
Well_Summary.DaysOn as proddaysproducing1, Wells.State AS Wstate, Wells.WellOperator as WellOperator, Wells.Status as wstatus, Leases.ClientId as lclient
FROM Wells INNER JOIN
Leases ON Wells.LeaseID = Leases.LeaseID CROSS JOIN
Well_Summary CROSS JOIN Co_Info CROSS JOIN
Company_Info inner join
dbo.ufnGetWellSummaryInformation on Wells.Wellid = wellid
WHERE (Leases.ClientID = 15) AND (Wells.WellOperator LIKE 'PETRO%') AND (Wells.State = 'ND') AND (Wells.APICode IS NOT NULL)
AND (Wells.Status NOT LIKE '%P&A%') AND (Well_Summary.YearMonth=@YearMonth) AND (Co_Info.ReportId = 'ND5')
ORDER BY Wells.APICode, Wells.WellName
END
getting the following error:
Msg 216, Level 16, State 1, Procedure ndform5queryforxml, Line 29
Parameters were not supplied for the function 'dbo.ufnGetWellSummaryInformation'.