How can I choose the db according to procedure parameter?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • efratk
    New Member
    • Feb 2008
    • 2

    How can I choose the db according to procedure parameter?

    I would like to write a stored procedure that gets database name as parameter and use this parameter inside the procedure:
    i.e. SELECT a from param_db.table1
    It seems that I can't use a parameter instead of the db name. Is there a work around?
  • sicarie
    Recognized Expert Specialist
    • Nov 2006
    • 4677

    #2
    Hmm, that's probably going to depend on what database you are using (MySQL, PostGRESQL, MSSQL, Oracle, etc...), and you should ask it in the appropriate forum.

    Comment

    • SatSunDev
      New Member
      • Feb 2008
      • 7

      #3
      I am also looking for something like that. Do you happen to find a solution for your problem? I am working in MSSQL 2005.


      Originally posted by efratk
      I would like to write a stored procedure that gets database name as parameter and use this parameter inside the procedure:
      i.e. SELECT a from param_db.table1
      It seems that I can't use a parameter instead of the db name. Is there a work around?

      Comment

      Working...