Re: How to pass servername as vaiable?
Posted in 1996
John Powell wrote:
>
>
> I need to know how to how to place the name of a server in
> a stored procedure variable and then use that variable as
> the server name when specifying a fully qualified table name
>
> I would like to go from something like this
>
>
> select * from mydatabase@myserver:mytable:>
>
> to something like this
>
>
> DEFINE hold_server char(8);
>
> LET holdserver = "myserver";
>
> select * from mydatabase@holdserver:mytable;>
>
John,
you can try to use synonyms in another database than mydatabase, i.e.
create synonym mysynonym for mydatabase@myserver:mytable;
Then in your SP you can use the following statement:
select servername into holdserver
from syssyntable
where tabname = "mytable"
and dbname = "mydatabase";
Regards,
Tolis Varnas
+---------------------------------------------------------------------+
| V+K Relational Solutions email: tvarnas@compulink.gr |
| Deligiorgi 26 tvarnas@orbit.de |
| 546 42 Thessaloniki Voice: (30) 31 820270 |
| Greece Fax: (30) 31 865463 |
+---------------------------------------------------------------------+