Hi
I would like to create a table-valued function where the database used is dependant on a variable passed. So for example
create function dbo.fn_TableFunction(@database as char(5))
Returns table as
return
(
select
field1
, field2
From
@database.dbo.tblTable1
)
this obviously doesnt work but i dont know of an alternative. I cant use a stored procedure as I want to select the results in another query.
Thanks in advance