Problems with output parameter

Problems with output parameter

Post by Bent Lun » Wed, 03 Mar 2004 22:59:23



Hi, how do i get the output parameter here?

I get the error message "Invalid Column Name 'CAST_ID' for some reason I
don't understand.

CREATE PROCEDURE MTS_GET_NEXT_CAST

AS

SELECT TOP 1 [CAST_ID] as CAST_ID
FROM V_STEP_DATA

OR(

    AND step_Order_no > (SELECT MAX(step_order_no) FROM V_STEP_DATA
WHERE

    )
ORDER BY step_no DESC, step_order_no desc


GO

Thanks, regards

Bent S. Lund
System Developer
MCP VB

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

 
 
 

Problems with output parameter

Post by Vishal Parka » Wed, 03 Mar 2004 23:13:03


above statement is not a valid one.

to assing value to variable run the select statement as:


FROM V_STEP_DATA

OR(

    AND step_Order_no > (SELECT MAX(step_order_no) FROM V_STEP_DATA
WHERE

    )
ORDER BY step_no DESC, step_order_no desc

--
Vishal Parkar


 
 
 

Problems with output parameter

Post by Armand » Wed, 03 Mar 2004 23:25:08


Look at the last line.... you're referring to


The proc doesn't know what [CAST_ID] is as it's column
with no related table.

Change the main query

from:

SELECT TOP 1 [CAST_ID] as CAST_ID

to:


and remove the last line


> Hi, how do i get the output parameter here?

> I get the error message "Invalid Column Name 'CAST_ID' for some reason I
> don't understand.

> CREATE PROCEDURE MTS_GET_NEXT_CAST



> AS

> SELECT TOP 1 [CAST_ID] as CAST_ID
> FROM V_STEP_DATA
> WHERE step_no < (SELECT MAX(step_no) FROM V_STEP_DATA WHERE cast_ID =

> OR(
>     step_no = (SELECT MAX(step_no) FROM V_STEP_DATA WHERE cast_ID =

>     AND step_Order_no > (SELECT MAX(step_order_no) FROM V_STEP_DATA
> WHERE

>     )
> ORDER BY step_no DESC, step_order_no desc


> GO

> Thanks, regards

> Bent S. Lund
> System Developer
> MCP VB

> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!