Solved

No parameters and arguments were supplied. Can anyone see my mistake here.

Posted on 2013-10-29
7
1,263 Views
Last Modified: 2013-10-29
I get the following error: The parameter is @DB_Include and when I run it I do put the value in the query a 0,1,2 but nothing works. I do not see where the argument is supplied. Can someone please clarify. Any way to identify an argument. Please advise. Here is the error.

Msg 8146, Level 16, State 1, Procedure Rpt_SnyderAccount_PL_Summary_RB, Line 0
Procedure Rpt_SnyderAccount_PL_Summary_RB has no parameters and arguments were supplied.

USE [WebSnakDS_SNYB_Test]
GO
/****** Object:  StoredProcedure [dbo].[Rpt_SnyderAccountP&LSummary_RB]    Script Date: 10/22/2013 11:47:19 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
--Declare 
	ALTER PROCEDURE [dbo].[Rpt_SnyderAccount_PL_Summary_RB] 
	(
	@DB_Include			int -- 0 = WebSNAK Only, 1 = RAMS Only, 2 = WebSNAK and RAMS 

	) AS
-----------------------------------------------------------------------------------
-- Creating TEMP Table Bringing Macola RAMS and WebSNAK together
-----------------------------------------------------------------------------------

CREATE TABLE #TEMPTABLE
		
(
	[Data_Source] VARCHAR(12),--  what database is the data coming from  macola or rams?
	[InvoiceDate] DATETIME,
	[SNAK_SaleTypesID] CHAR (1),
	[CustPromoAmt] MONEY,
	[MFGCostAmt] MONEY, 
	[GrossAmt] MONEY,
	[CustName] VARCHAR(30),
	[SNAK_CustomerID] VARCHAR(8),
	[ChainName] VARCHAR(30),
	[SNAK_ChainID] VARCHAR(10)
	
	
)

 
-----------------------------------------------------------------------------------
-- WEBSNAK DATA
-----------------------------------------------------------------------------------

if (@DB_Include = 0 or @DB_Include = 2) -- 0 = WebSNAK Data only; 2 = Both WebSNAK and RAMS data
	BEGIN
	
INSERT  INTO #TEMPTABLE

SELECT
	'WEBSNAK',
	Invoices.InvoiceDate AS InvoiceDate,
	InvoiceDetails.SNAK_SaleTypesID AS SNAK_SaleTypesID, 
	InvoiceDetails.CustPromoAmt AS CustPromoAmt,
	InvoiceDetails.MFGCostAmt AS MFGCostAmt,
	InvoiceDetails.GrossAmt AS GrossAmt,
	Customers.CustName AS CustName, 
	Customers.SNAK_CustomerID AS SNAK_CustomerID,
	Chains.ChainName AS ChainName, 
	Chains.SNAK_ChainID AS SNAK_ChainID
FROM
    { oj ((dbo.Invoices Invoices 
     INNER JOIN dbo.Customers Customers 
			ON	Invoices.Customers_Syskey = Customers.Customers_Syskey)
     INNER JOIN dbo.InvoiceDetails InvoiceDetails 
			ON	Invoices.Invoices_Syskey = InvoiceDetails.Invoices_Syskey)
     INNER JOIN dbo.Chains Chains 
			ON	Customers.Chains_Syskey = Chains.Chains_Syskey}
--WHERE
	--((Invoices.InvoiceDate >= {ts '2012-01-10 00:00:00.00'} AND
    --Invoices.InvoiceDate < {ts '2012-09-11 00:00:00.00'}) OR
    --(Invoices.InvoiceDate >= {ts '2013-01-10 00:00:00.00'} AND
    --Invoices.InvoiceDate < {ts '2013-09-11 00:00:00.00'}))

END
-----------------------------------------------------------------------------------
--RAMS DATA--
-----------------------------------------------------------------------------------

if (@DB_Include = 1 or @DB_Include = 2) -- 1 = RAMS Data only; 2 = Both WebSNAK and RAMS data
	BEGIN
	
INSERT  INTO #TEMPTABLE

SELECT
    	'RAMS',
    	ROSS_SALESHDR.OH_DELIVERY_DATE AS InvoiceDate,
    	ROSS_SALESDTL.OD_RECORD_TYPE AS SNAK_SalesTypesID,
 		CustPromoAmt = SUM(ROSS_SALESDTL.OD_TOTAL_DELIV_QUANTITY * ROSS_SALESDTL.OD_NET_PROMO_PRICE),
 		MFGCostAmt = SUM(ROSS_SALESDTL.OD_TOTAL_DELIV_QUANTITY * ROSS_SALESDTL.OD_PRODUCT_COST_PRICE),
 		GrossAmt = SUM(ROSS_SALESDTL.OD_TOTAL_DELIV_QUANTITY * OD_BASE_PRICE),
 		ROSS_CUSTOMER.CM_FULLNAME AS CustName,
    	RAMS_CrossRef.RAMS_CHAIN_NO AS SNAK_CustomerID,
    	RAMS_CrossRef.SNAK_CHAIN_NO AS ChainName,
    	RAMS_CrossRef.CHAIN_IDENT AS SNAK_ChainID
    	
    	
FROM
     CHLROS05.RAMSDB.dbo.ROSS_SALESHDR ROSS_SALESHDR 
	INNER JOIN CHLROS05.RAMSDB.dbo.ROSS_CUSTOMER ROSS_CUSTOMER 
		ON ROSS_SALESHDR.OH_CUSTOMER_NUMBER = ROSS_CUSTOMER.CM_CUSTKEY
    INNER JOIN CHLROS05.RAMSDB.dbo.ROSS_SALESDTL ROSS_SALESDTL 
		ON ROSS_SALESHDR.OH_TICKET_NUMBER = ROSS_SALESDTL.OD_TICKET_NUMBER
		AND ROSS_SALESDTL.OD_RECORD_TYPE IN ('S','R','M')
    INNER JOIN CHLROS05.RAMSDB.dbo.ROSS_PRODUCTS ROSS_PRODUCTS 
		ON ROSS_SALESDTL.OD_PRODUCT = ROSS_PRODUCTS.PRD_PRODUCT
	LEFT OUTER JOIN CHLROS05.RAMSDB.dbo.ROSS_IDCODE ROSS_IDCODE1
        ON ROSS_CUSTOMER.CM_SELLZONE = ROSS_IDCODE1.ID_FIELD
    LEFT OUTER JOIN CHLROS05.RAMSDB.dbo.ROSS_IDCODE ROSS_IDCODE2
        ON ROSS_PRODUCTS.PRD_A_GLTYPE = ROSS_IDCODE2.ID_FIELD 
	INNER JOIN WebSnakDS_SNYB_test.dbo.RAMS_CrossRef RAMS_CrossRef
		ON ROSS_CUSTOMER.CM_CHAINID = RAMS_CrossRef.RAMS_CHAIN_NO
		
--WHERE
    --ROSS_SALESHDR.OH_DELIVERY_DATE >= {ts '2013-01-01 00:00:00.00'} AND
    --ROSS_SALESHDR.OH_DELIVERY_DATE < {ts '2013-04-30 00:00:00.00'} --AND
    --ROSS_SALESDTL.OD_PRODUCT >= '0*' AND
    --ROSS_SALESDTL.OD_PRODUCT <= '9999*' AND
    --ROSS_SALESDTL.OD_RECORD_TYPE = 'O' --AND
    --(ROSS_CUSTOMER.CM_DELIVZONE = '400002' OR
    --ROSS_CUSTOMER.CM_DELIVZONE = '400001')
    
GROUP BY
        ROSS_SALESHDR.OH_DELIVERY_DATE,
        ROSS_SALESDTL.OD_RECORD_TYPE,
        ROSS_CUSTOMER.CM_FULLNAME,
        RAMS_CrossRef.RAMS_CHAIN_NO,
        RAMS_CrossRef.SNAK_CHAIN_NO,
        RAMS_CrossRef.CHAIN_IDENT

    END
    
    SELECT * FROM #TEMPTABLE

Open in new window

0
Comment
Question by:ruavol2
7 Comments
 
LVL 8

Accepted Solution

by:
5teveo earned 250 total points
ID: 39609734
Set a default value for paramter as follows then use print command debug as needed... verify you are sending paramenter if needed

i added '= 0' after 'int'


ALTER PROCEDURE [dbo].[Rpt_SnyderAccount_PL_Summary_RB]
      (
      @DB_Include int = 0 -- 0 = WebSNAK Only, 1 = RAMS Only, 2 = WebSNAK and RAMS
      ) AS
.
.
.
.
rest of stored procedure
.
.
.
0
 
LVL 40

Assisted Solution

by:Kyle Abrahams
Kyle Abrahams earned 125 total points
ID: 39609738
You have to add a parameter to crystal . . . and specify it there.

Ensure you have the parameter named correctly with the right data type.



Confirm you get data if you run this from SSMS:
exec Rpt_SnyderAccount_PL_Summary_RB  2
0
 
LVL 100

Assisted Solution

by:mlmcc
mlmcc earned 125 total points
ID: 39609831
Remove the  (  ) in lines 10 and 13

      ALTER PROCEDURE [dbo].[Rpt_SnyderAccount_PL_Summary_RB]
      (
      @DB_Include                  int -- 0 = WebSNAK Only, 1 = RAMS Only, 2 = WebSNAK and RAMS

      ) AS

mlcc
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

Author Comment

by:ruavol2
ID: 39609837
This is what I get when I put your code in Steveo

Msg 208, Level 16, State 1, Procedure Rpt_SnyderAccount_PL_Summary_RB, Line 10
Invalid object name 'dbo.Invoices'.
Msg 208, Level 16, State 1, Procedure Rpt_SnyderAccount_PL_Summary_RB, Line 10
Invalid object name 'dbo.Customers'.
Msg 208, Level 16, State 1, Procedure Rpt_SnyderAccount_PL_Summary_RB, Line 10
Invalid object name 'dbo.InvoiceDetails'.
Msg 208, Level 16, State 1, Procedure Rpt_SnyderAccount_PL_Summary_RB, Line 10
Invalid object name 'dbo.Chains'.

Open in new window


I am only running it for Crystal Reports after it is ready. There is no report assigned to it.
0
 

Author Comment

by:ruavol2
ID: 39610095
I tried all those options and none I am afraid worked. I get the SP has no parameters and arguments were supplied.
0
 
LVL 8

Assisted Solution

by:5teveo
5teveo earned 250 total points
ID: 39610120
Please verify your StoredProcedure runs error-free in SQL management environment

are you getting same errors outside Crystal call?
0
 

Author Closing Comment

by:ruavol2
ID: 39610147
SSMS had switched in window to a different server. Don't know if I did it or another IT staffer but when I looked at the window it showed.

Rpt_SnyderAccount_PL_Summary_RB  2 it switches to a different server. So sorry about that.
Maybe there is some value there......Check the darn Server Window RUAVOL2......!
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Viewers will learn how the fundamental information of how to create a table.

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question