Friday, March 9, 2012

how to retun results from Stored Proc

Hi to all

I would need some help with mySQL 2005 Stored Proc. This is the first time that i'm using them so sry if i seem a bit noobish.
I would need to return a set of rows by using an sql statment.
Can some1 tell me one i need to change in my code in order to return the rows?

Thanks

this is the code ...

USE [MPS_TEST2]
GO
/****** Object: StoredProcedure [dbo].[spMachine_Get_By_Model_ID] Script Date: 07/19/2007 14:17:45 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

ALTER proc [dbo].[spMachine_Get_By_Model_ID]

(@.Model_ID bigint)

AS
SELECT Machine_ID
FROM tblMachine

WHERE(tblMachine.Machine_Model_ID = @.Model_ID)

Return

Quote:

Originally Posted by Talghagin

Hi to all

I would need some help with mySQL 2005 Stored Proc. This is the first time that i'm using them so sry if i seem a bit noobish.
I would need to return a set of rows by using an sql statment.
Can some1 tell me one i need to change in my code in order to return the rows?

Thanks

this is the code ...

USE [MPS_TEST2]
GO
/****** Object: StoredProcedure [dbo].[spMachine_Get_By_Model_ID] Script Date: 07/19/2007 14:17:45 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

ALTER proc [dbo].[spMachine_Get_By_Model_ID]

(@.Model_ID bigint)

AS
SELECT Machine_ID
FROM tblMachine

WHERE(tblMachine.Machine_Model_ID = @.Model_ID)

Return


try a function instead|||

Quote:

Originally Posted by Talghagin

Hi to all

I would need some help with mySQL 2005 Stored Proc. This is the first time that i'm using them so sry if i seem a bit noobish.
I would need to return a set of rows by using an sql statment.
Can some1 tell me one i need to change in my code in order to return the rows?

Thanks

this is the code ...

USE [MPS_TEST2]
GO
/****** Object: StoredProcedure [dbo].[spMachine_Get_By_Model_ID] Script Date: 07/19/2007 14:17:45 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

ALTER proc [dbo].[spMachine_Get_By_Model_ID]

(@.Model_ID bigint)

AS
SELECT Machine_ID
FROM tblMachine

WHERE(tblMachine.Machine_Model_ID = @.Model_ID)

Return


I think if you take out the Return at the end then stored procedure will return the result of the query.

No comments:

Post a Comment