Share via

Unable to access table through application user

Thouheed B 21 Reputation points
2021-11-15T06:20:18.187+00:00

I have a table master.t_user_daily_aggregation table in one DB. I have created/configured external table master.t_daily_daily_aggregation in different DB(Report DB). When i try to access this table in Report DB as a master user with schema 'master' I can able to see the records where as when I try to access the table as application without schema 'master' i am getting the below error.

with Schema: Select * from master.T_USERS_DAILY_AGGREGATION
without Schema: Select * from T_USERS_DAILY_AGGREGATION

Msg 46833, Level 16, State 2, Line 3
An error occurred while excecuting query on remote server:
[Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Invalid object name 'T_USERS_DAILY_AGGREGATION'.

Note: The default schema for the application user is master. In other environment I can able to fetch records for application user. Only in QA env I am unable to fetch the records.

Please help me to resolve this issue.

Azure SQL Database
SQL Server Reporting Services
SQL Server Reporting Services

A SQL Server technology that supports the creation, management, and delivery of both traditional, paper-oriented reports and interactive, web-based reports.

Developer technologies | Transact-SQL
Developer technologies | Transact-SQL

A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.

0 comments No comments

1 answer

Sort by: Most helpful
  1. Erland Sommarskog 134.7K Reputation points MVP Volunteer Moderator
    2021-11-15T22:53:38.593+00:00

    The error would indicate that in the QA environment the default schema for the application user is something else than master. Try running:

    ALTER USER applicationuser WITH DEFAULT_SCHEMA = master
    

    I would suggest, though, that once you start working with other schemas than dbo, you should always prefix tables with the schema.

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.