Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2004
    Posts
    7

    Unanswered: Using qualified names of databases

    I have databases a1 , a2 , a3 , a4 ... an.
    Each has a table t1 .

    I am writing a stored proc which compares the t1 table between any given two databases.
    I want to pass the database name as a variable ..
    so the SPROC looks like

    exec sp_comparetable 'a3' , 'a7'

    My question is , inside the SPROC ,how do I refer to the tables in the a3 and a7 databases.


    Thanks,
    Alok.

  2. #2
    Join Date
    Jan 2003
    Location
    India
    Posts
    523
    DatabaseName..TableName

  3. #3
    Join Date
    Apr 2004
    Posts
    7
    The database name is a variable. In that case the .. operator does not work.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •