Simple Stored Proc Question

Ask a Question related to Coldfusion Database Access, Design and Development.

  1. #1

    Default 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

  2. Similar Questions and Discussions

    1. 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...
    2. 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...
    3. 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...
    4. 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...
    5. 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...
  3. #2

    Default 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

  4. #3

    Default Re: Simple Stored Proc Question

    Thanks. very helpful.
    bzydaddy Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139