Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2003

    Unanswered: variable in view - ms sql

    I want to create a view with database name as passing parameter

    I have a view which has two databases.

    i want the database name to be passed as parameter for view. is that possible

    see the below mentioned view

    Create View VSample as
    select table1.col1, table2.col2
    from dbname..table1 a, dbname..table2 b where
    a.col1 = b.col1

    I want to pass dbname as parameter. Is that possible

  2. #2
    Join Date
    Feb 2004

    Re: variable in view - ms sql

    I wouldnt think so, you might want to try using a procedure instead. However, I wonder why you'd like to make this change since the current use of two views makes clear that both might get access using views, and perhaps, external tools. Its usefull to have that kind of information.

  3. #3
    Join Date
    Feb 2004
    not shure about view but shure it's pssible in Stored Procedure

    exec "select table1.col1, table2.col2
    from "+@DBName+".table1 a, dbname..table2 b where
    a.col1 = b.col1"
    MDB, ADP <-> MS SQL + VBA, ADO & RDO, .NET, Oracle, Java/Jsp.

Posting Permissions

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