Ask a Question related to Coldfusion Database Access, Design and Development.
-
bzydaddy #1
Simple Stored Proc Question
I have a simple stored procedure that returns text.
CREATE PROCEDURE sactest AS
PRINT 'SAC was here'
GO
Question: How do I capture the result of thise procedure in my program?
<CFSTOREDPROC PROCEDURE="sactest" DATASOURCE="dbname" debug="yes"
returncode="yes">
</CFSTOREDPROC>
bzydaddy Guest
-
SQL Stored Proc question
I have a rather large cfquery slowing me down. i can build simple stored procs but I dont know anything advanced. Can you take a cfquery like... -
cfc and stored proc
does anyone know if there is documentation anywhere that states that in ColdFusion MX 6.1 when you try to pass parameters to a stored procedure via... -
ASP vs Stored Proc vs UDF
Hi all, I have a field in Table A that must be updated whenever a record is added to Table B. Table A will always only contain one single record... -
Simple stored proc in query question
Is this possible? Table_1 Col1 Col2 Col3 a e b f c g UPDATE Table_1 SET Col3 = Some_Stored_Proc... -
stored proc and tcp/ip
Hello, is it possible to communicate with another program using tcp/ip? I mean, i have another program where i know the port number and the... -
mxstu #2
Re: Simple Stored Proc Question
You could return the results in either an output parameter or a resultset .
Return codes are typically used for returning a numeric status indicating the
success or failure of the stored procecure (0 - Success, Otherwise failure).
Attached are (3) simple examples of using ms sql stored procedures.
--- examples of ms sql stored procedures
CREATE PROCEDURE testOutputParam @outParam varchar(100) OUTPUT
AS
BEGIN
SET @outParam = 'The time is: '+ cast(getDate() as varchar(25))
END
GO
CREATE PROCEDURE testResultSet
AS
BEGIN
SELECT getDate() AS TimeEntered
END
GO
CREATE PROCEDURE testReturnCode
AS
BEGIN
RETURN 999
END
GO
<!--- using output variable --->
<cfstoredproc procedure="testOutputParam" datasource="#yourDSN#"
returncode="yes">
<cfprocparam type="out" dbvarname="@outParam" cfsqltype="cf_sql_varchar"
variable="theOutputVariable">
</cfstoredproc>
<cfoutput><b>output variable:</b> #theOutputVariable#</cfoutput><hr>
<!--- using resultset --->
<cfstoredproc procedure="testResultSet" datasource="#yourDSN#"
returncode="yes">
<cfprocresult name="theResultSet">
</cfstoredproc>
<b>resultset:</b> <cfdump var="#theResultSet#"><hr>
<!--- using return code --->
<cfstoredproc procedure="testReturnCode" datasource="#yourDSN#"
returncode="yes">
</cfstoredproc>
<cfoutput><b>returncode:</b> #CFSTOREDPROC.STATUSCODE#</cfoutput><hr>
mxstu Guest
-



Reply With Quote

