I am having strange results with a stored procedure that returns records
from a view. The view (vwMergeListing) returns about 20 fields. My stored
procedure takes a parameter which determines whether all or some of the
fields are returned (M=some of the fields, F=all of the fields).
The strange thing is that, though the sp is working with the parameter
correctly, it seems stuck on displaying one recordset or the other. That is,
sometimes it displays the "M" recordset, and then, when I pass it "F", it
returns the "F" fields, but only as they match the "M" fields. Similarly,
sometimes it returns all fields in the "F" recordset, and then, when I pass
it "M", it returns the "M" fields but with all "F" fields showing (the "F"
fields that aren't in the "M" recordset display "#Name").
I'm running this from an Access 2000 ADP file. I tried two forms of SQL in
the sp: one with direct SQL, and one with building a SQL string. Below are
the two SPs. Any assistance would be appreciated.
Thanks!
Neil
Alter Procedure "Rep_MergeListing1"
AS
SET NOCOUNT ON
Select Name, MergeID, Description, LINE1, LINE2, LINE3, ZIPCODE,
DEALRET, [Index]
From vwMergeListing
Select * From vwMergeListing
RETURN(0)
On_Error:
RETURN(1)
AS
SET NOCOUNT ON
When 'M' Then
'Select Name, MergeID, Description, LINE1, LINE2, LINE3,
ZIPCODE, DEALRET, [Index] ' +
'From vwMergeListing'
When 'F' Then
'Select * From vwMergeListing'
End
RETURN(0)
On_Error:
RETURN(1)