I’m migrating SPs from Sybase to SQL Server and I have a case where they use “proxy tables” which are used to internally invoke a SP whenever they are used in a query…
The syntax used to create the proxy table is something like this:
USE myDatabase
go
sp_addobjectdef proxy_table_name, 'loopback.myDatabase..sp_name', 'rpc'
go
CREATE EXISTING TABLE proxy_table_name
(
col1 int NOT NULL,
col2 char(2) NOT NULL,
col3 varchar(20) NOT NULL,
_id_sp int NULL
)
LOCK ALLPAGES
go
And the SP definition something like this:
CREATE procedure sp_search_intermediary_agent
(
@param_default_1 char(1) = 'N',
@param_default_2 bit = 0,
@i_id_query int
)
as
begin
........ (some code here)
select col1, col2, col3 from table_where_data_is
where id_table = @i_id_query
return 0
end
go
And the proxy table is used within the query as if it were a normal table…
select col1, col2, col3,....
from table_1, proxy_table_name
where table_1.id_field = proxy_table_name._id_sp
Please, any ideas about how to migrate this “proxy tables” to SQL Server 2008??
Looks like a table valued function.