Why does SQL 2008 Profiler indicate that Stored Procedure run from EF4 is in Master?

Using Entity Framework 4 with stored procedures and SQL Server 2008 SP1… When running SQL Server Profiler (TSQL_SPs template), the lines that show my stored procedure call and its statements say that this happened in DatabaseID = 1 (Master) but it is actually happening in my application database. The procedures execute properly and return the data, and they only exist in my application database, so why does Profiler mark those lines as being in Master? Is this a bug in Profiler?

Note that running the same code against a SQL 2000 instance, Profiler correctly shows the application’s database ID.

  • Performance difference between Primary Key and Unique Clustered Index in SQL Server
  • SQL Server 2000 - How do I rotate the results of a join in the final results of a query?
  • Hiding tables from database users
  • Invalid column name “USER_SOURCE”
  • SSIS - Derived Column Calculation Error
  • How to check that there is transaction that is not yet committed in SQL Server 2005?
  • UPDATE: I have now tested this on a new installation of SQL Server 2008 R2 and it still displays this as if it happened in Master.

    UPDATE 2: This has been logged to Connect at https://connect.microsoft.com/SQLServer/feedback/details/572246/profiler-reports-ef4-queries-as-occurring-in-master.

  • Grouping data in SQL Server for particular patterns
  • How can I to read a XML from a URL using T-SQL?
  • Handshake exception occurring when connecting to SQL Server Azure with .NET 4.5
  • What happens to an uncommitted transaction when the connection is closed?
  • SQL Server database change workflow best practices
  • Database Function VS Case Statement
  • One Solution collect form web for “Why does SQL 2008 Profiler indicate that Stored Procedure run from EF4 is in Master?”

    Contains youir connectionstring the option ‘MultipleActiveResultSets=True’? If yes, try to remove it and look at sql profiler.

    MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.