Subject | Stored procedure to work with specified table/fields? |
---|---|
Author | sgharp |
Post date | 2004-06-18T23:17:02Z |
Hi All,
I'd like to write a stored procedure that is generic and independent
of hard coded table and field names. For instance:
create procedure spTest(sTable VarChar(255), sField VarChar(255))
returns (pResult Integer)
as
Begin
select :sField from :sTable
where this = that
into :pResult;
suspend;
End
This barfs with a parsing error. Is there anyway to do this? I
need to write a series of stored procedures to work against
temporary tables that are created and dropped on the fly so the
table names won't be known until runtime.
Thanks for any suggestions,
Steve
I'd like to write a stored procedure that is generic and independent
of hard coded table and field names. For instance:
create procedure spTest(sTable VarChar(255), sField VarChar(255))
returns (pResult Integer)
as
Begin
select :sField from :sTable
where this = that
into :pResult;
suspend;
End
This barfs with a parsing error. Is there anyway to do this? I
need to write a series of stored procedures to work against
temporary tables that are created and dropped on the fly so the
table names won't be known until runtime.
Thanks for any suggestions,
Steve