Distributed query problem

  • Now posted in GENERAL

    In a stored proc I am using a cursor to access columns from a table on another server, so my T-Sql is something like 'SELECT Action FROM bid.mips.dbo.Actions AS TA INNER JOIN ...' etc. where bid is the server, mips the database. This is fine for development but when I go live I will have to modify the procedure to have the correct server name. Instead, can I make the server name and/or database name dynamic (e.g. by looking it up in a table). Security issues prevent me from executing a dynamic T-sql string.

    Edited by - neil davidson on 06/02/2003 08:06:46 AM

  • When you create a linked server, you can make the name of the server anything you want (separately from the actual network name of the server). You can make the name a logical name rather than a physical name. This will help you if you are migrating from development to production (on different servers) but will not help you if you are on the same SQL instance.

    There is no way to handle the database name unless you use dynamic SQL.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply