I have written the following stored procedure:
ALTER PROCEDURE ProcGet
-- Add the parameters for the stored procedure here
@id as int output,
@name as varchar(50) output
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
SELECT @id = p_id, @name = p_name FROM pos
END
GO
"pos" table has three columns. but i only want to retreive two columns, when i used the storedprocedure like above the application doesnt retreive any values
but when i write the stored procedure to to retreive all teh columns in the tables it works perfectly well. How do i retrieve only two columns of data from teh above give table?
is there something wrong with my stored procedure?
Loading
LisaPosted Apr 1, 2009, 9:16 AM
Yes, there is a mistake with your procedure never return values as parameters rather return them as result sets
so instead of your select command simply use
SELECT p_id as id , p_name as name FROM pos
it should work well.
Thanks,
Lisa