Ask a Question related to Coldfusion Database Access, Design and Development.
-
tempestweb #1
MSSQL Stored Procedure
This is my first attempt at using sotred procedures, and a slight problem has
come up. I'm collecting data to order a widget, and the first thing I want to
do is create an order ID, in this case called "prodID" wit a sotred procedure.
I'm putting dummy values into the fields that do nto allow null:
CREATE PROCEDURE NewProdForm
@custUUID varchar (36),
@pttType varchar(20),
@pttWeight int,
@initDate datetime,
@delDate datetime,
@prodID int = null OUTPUT
AS
-- make a new enpty line in the production table
INSERT INTO production (custUUID, pttType, pttWeight, initDate,delDate)
VALUES (@custUUID,@pttType,@pttWeight,@initDate,@delDate)
-- send back the record number as prodID
SET @prodID = @@IDENTITY
RETURN 1
GO
In the page where I'm calling the stored procedure, I'm getting an error that
the prodID variable doesn't exist.
<CFSTOREDPROC procedure="microwavetelem.NewProdForm"
datasource="microwavetelem" username="microwavetelem" password="#verb#">
<CFPROCPARAM type="IN" dbvarname="@custUUID" value="#FORM.custUUID#"
cfsqltype="CF_SQL_VARCHAR">
<CFPROCPARAM type="IN" dbvarname="@pttType" value="PTT"
cfsqltype="CF_SQL_VARCHAR">
<CFPROCPARAM type="IN" dbvarname="@pttWeight" value="80"
cfsqltype="CF_SQL_INTEGER">
<CFPROCPARAM type="IN" dbvarname="@initDate" value="1/1/1900"
cfsqltype="CF_SQL_TIMESTAMP">
<CFPROCPARAM type="IN" dbvarname="@delDate" value="1/1/1900"
cfsqltype="CF_SQL_TIMESTAMP">
<CFPROCPARAM type="OUT" dbvarname="@prodID" variable="prodID"
cfsqltype="CF_SQL_INTEGER">
<CFPROCRESULT name="rsGetProdID">
</CFSTOREDPROC>
" Element PRODID is undefined in RSGETPRODID."
What did I miss? I know the records are being created, but the ID isn't being
provided to the next step in the process, which is to add that number in a
field in another data table with a #rsGetProdID.prodID# to put the number where
I want it.
tempestweb Guest
-
Stored Procedure call using MSSQL::DBLIB
I'm trying to call a stored procedure from a perl script using the MSSQL::DBLIB module. My stored procedure requires three parameters (date, id #,... -
MSSQL Stored Procedure Problem
I am trying to pass some variables into a MSSQL stored procedure and for some reason it is truncating the last variable. If I move the order of the... -
Can Flash call an MSSQL stored procedure?
Is it possible to get Flash MX2004 pro to execute a stored procedure in a MSSQL database? Each time I run a particular SWF I would like the... -
MS SQL stored procedure
I am new to MS SQL server and stored procedures. I currently have a query that looks like: select from table where fieldname IN... -
need help on a stored procedure
I have 2 tables. table1 and table2 I do a select on table1 and join table 2 on id. I want to check newprice in table1. if it is null, I want to... -
woodfoot #2
Re: MSSQL Stored Procedure
Try this:
In your stored proc:
change this:
SET @prodID = @@IDENTITY
RETURN 1
to:
SELECT @@IDENTITY as BPFID;
RETURN(1)
See if that works for ya.
woodfoot Guest
-
woodfoot #3
Re: MSSQL Stored Procedure
sorry
to:
SELECT @@IDENTITY as prodID;
RETURN(1)
woodfoot Guest
-
woodfoot #4
Re: MSSQL Stored Procedure
Additionally, I do not believe you need the output parameter:
<CFPROCPARAM type="OUT" dbvarname="@prodID" variable="prodID" cfsqltype="CF_SQL_INTEGER">
I know I've never have had to use this...
woodfoot Guest
-
tempestweb #5
Re: MSSQL Stored Procedure
This was copied from an example in CFMX7 Web Application Construction Kit; the CFPARAM OUT was there, so I used it. The
SELECT @@IDENTITY as prodID;
RETURN(1)
worked. Thank you.
tempestweb Guest



Reply With Quote

