Create your stored proc as follws......

CREATE PROCEDURE (procedure name> AS

        @inputparam1    <datatype>
        @inputparam2    <datatype>
        @inputparam3    <datatype>
        ..
        ..
        @outputparam    <datatype> OUT

BEGIN
        INSERT INTO <tablename> (<filedlist>)
        VALUES(<valuelist>)
        SELECT @outputparam = ID FROM INSERTED
END
GO

Then in your CF you set up a CFPROCPARAM as type OUT.  Remeber that you must
have the parameters declare in the same order in CF as you do in the SP

-----Original Message-----
From: Neil H. [mailto:[EMAIL PROTECTED]]
Sent: 24 August 2000 15:48
To: [EMAIL PROTECTED]
Subject: Re: Stored Procedure


Right, but I think I am missing how to set the outputparam as output in the
Stored Procedure?  What is the syntax to set it as an out param?

Thanks,

Neil

----- Original Message -----
From: "Andy Ewings" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, August 24, 2000 10:22 AM
Subject: RE: Stored Procedure


> Are you inserting data into a table which automatically creates an ID
> (IDENTITY filed)?  If so what you want to do is perform the INSERT
statement
> in your SP and then immediately afterwards interrogate the INSERTED table.
> This is a table which SQL automatically creates with exactly the same
> structure as the table you are insering into when you are performing an
> Insert or an Update and it contains all of the rows that you
> inserted/updated.
>
> So, if you are only inserting one row you want.....
>
> INSERT INTO <tablename> (<filedlist>)
> VALUES(<valuelist>)
>
> SELECT @outputparam = ID FROM INSERTED
>
> where @outputparam is your output parameter declared in the SP and in CF
>
>
> -----Original Message-----
> From: Neil H. [mailto:[EMAIL PROTECTED]]
> Sent: 24 August 2000 15:15
> To: [EMAIL PROTECTED]
> Subject: Stored Procedure
>
>
> I am trying to write a storedproc that does an insert and then returns a
> value.  The problem is this, I pass in about 15 variable as Type="IN" in
> cfprocparam.   Then I want one type="OUT" called UserID.  Anyway what do I
> have to write in the Stored Proc itself to allow that to happen.
>
> Thanks,
>
> Neil
>
> --------------------------------------------------------------------------
--
> --
> Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
> To Unsubscribe visit
> http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
> send a message to [EMAIL PROTECTED] with 'unsubscribe' in
> the body.
> --------------------------------------------------------------------------
----
> Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
> To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
>

----------------------------------------------------------------------------
--
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to