Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 2nd, 2005, 12:26 PM
Registered User
 
Join Date: May 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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'



 
Old August 2nd, 2005, 11:28 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

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


 
Old August 3rd, 2005, 03:01 AM
Registered User
 
Join Date: Aug 2005
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Inserting Values in Database OracleCommand VB.NET narendra_patil BOOK: Beginning ASP.NET 1.0 0 April 22nd, 2005 07:35 AM
inserting values into a database RPG SEARCH ASP.NET 1.0 and 1.1 Basics 3 February 5th, 2005 07:56 PM
Inserting a file into a table of a database Hari_Word ADO.NET 1 August 20th, 2004 05:15 AM
inserting values error - Please help gtmm9 Classic ASP Databases 1 October 6th, 2003 11:43 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.