Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old August 2nd, 2005, 12:26 PM
Registered User
 
Join Date: May 2005
Location: , , .
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'



Reply With Quote
  #2 (permalink)  
Old August 2nd, 2005, 11:28 PM
Friend of Wrox
Points: 4,332, Level: 27
Points: 4,332, Level: 27 Points: 4,332, Level: 27 Points: 4,332, Level: 27
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2003
Location: , NJ, USA.
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

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


Reply With Quote
  #3 (permalink)  
Old August 3rd, 2005, 03:01 AM
Registered User
 
Join Date: Aug 2005
Location: , , .
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.

Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 06: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



All times are GMT -4. The time now is 02:42 AM.


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