p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   SQL Server 2000 (http://p2p.wrox.com/forumdisplay.php?f=20)
-   -   Error while inserting values into database table (http://p2p.wrox.com/showthread.php?t=32075)

pothireddy_s August 2nd, 2005 12:26 PM

Error while inserting values into database table
 
I have the following StoredProcedure.

CREATE PROCEDURE spPOItemAllocationCreate
@pPOItemID INT,
@pShipTo VARCHAR(100),
@pQuantity INT,
@pNotes VARCHAR(2000),
@pUser CHAR(10)
AS
DECLARE @ShipToID INT
SET @ShipToID = (SELECT ShipToID FROM dbo.ShipTo
     WHERE ShipTo=@pShipTo)
INSERT dbo.POItemAllocation(POItemID, ShipToID, Quantity, Notes, LastModifiedDate, LastModifiedUser)
VALUES (@pPOItemID,
     @ShipToID,
     @pQuantity,
     @pNotes,
     GETDATE(),
     @pUser)

I am passing values from code like

spPOItemAllocationCreate @pPOItemID=76,@pShipTo='Stores',@pQuantity=4,000,@ pNotes='Notes',@pUser='MM'


In table
POItemID int , ShipToID int , Quantity int, Notes varchar, LastModifiedDate datetime, LastModifiedUser char(10)

I am getting the following ERROR : : Must pass parameter number 4 and subsequent parameters as '@name = value'. After the form '@name = value' has been used, all subsequent parameters must be passed in the form '@name = value'




jbenson001 August 2nd, 2005 11:28 PM

Call the procdure like this:
spPOItemAllocationCreate 76,'Stores',4000,'Notes','MM'



CalliP August 3rd, 2005 03:01 AM

Yes. What jbenson001 said.

Your original query would've worked too, except you indicated the number 4000 as 4,000 (for @pQuantity) - a comma is strictly used to separate parameters, you can't use it in a number.



All times are GMT -4. The time now is 01:07 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.