Forum Discussion

HW31's avatar
HW31
New Member
5 years ago
Solved

Limit access to a single database on a server

When connecting a power bi, i have to connect to the server, and optionally, a dB. This server has several dBs on it and I was wondering is there a way to limit the access of the pbi file to a single server? Surely once connected, you can access all databases.

  • GilbertQ's avatar
    GilbertQ
    5 years ago
    Hi there

    The first thing is that you would need the permissions to access all the databases.

    IF you do have permissions you could access all the databases through a single connection.

    For example if your main connection uses a database called: MyFirstDatabase the TSQL Query could be

    Select *
    from MyFirstDatabase.dbo.table_Name

    Now if you wanted to access another database on the same server, where the other database is called "SecondDatabase" you could use the following TSQL Query

    Select *
    from SecondDatabase.dbo.tableName

2 Replies

  • HW31 

     

    To do that you have to state which Database you want to use when connecting to the server.

     

     

    • GilbertQ's avatar
      GilbertQ
      Super User
      Hi there

      The first thing is that you would need the permissions to access all the databases.

      IF you do have permissions you could access all the databases through a single connection.

      For example if your main connection uses a database called: MyFirstDatabase the TSQL Query could be

      Select *
      from MyFirstDatabase.dbo.table_Name

      Now if you wanted to access another database on the same server, where the other database is called "SecondDatabase" you could use the following TSQL Query

      Select *
      from SecondDatabase.dbo.tableName