Sql profiler is not part of sql server 2008 express

Info icon This preview shows pages 588–590. Sign up to view the full content.

View Full Document Right Arrow Icon
SQL Profiler is not part of SQL Server 2008 Express, not even if you install the version with advanced services and Management Studio. You will need a full edition of SQL Server. (The Developer edition will do.) SQL Profiler works just fine with the Express version of the database, but it’s distributed and licensed only as part of the fuller editions. As long as you have a suitable license, you can install just the tools from a full edition SQL Server onto a machine that has only the Express version of the database, and it will work just fine. (Unfortunately, if you already installed the Express version of Management Studio, you can’t install the full management tools on the same machine.) A full description of the SQL Profiler is beyond the scope of this book— we’re using it to show you exactly what the Entity Framework asked the database to do. However, it’s a profoundly useful tool; even if you use it only for the simple task of discovering what SQL queries are being executed. If you plan to do much work with databases, it’s well worth learning how to use it. By single-stepping through the code in Visual Studio while running the SQL Profiler, we can see that nothing appears in the profiler until we start to execute the foreach loop, at which point the profiler shows an Audit Login message, indicating that our program has opened a connection to the database. This is followed by a 564 | Chapter 14: Databases
Image of page 588

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
RPC:Completed message, indicating that SQL Server processed a request. When we select this message, the profiler shows the SQL that the EF just ran for us: exec sp_executesql N'SELECT [Extent1].[SalesOrderID] AS [SalesOrderID], [Extent1].[RevisionNumber] AS [RevisionNumber], [Extent1].[OrderDate] AS [OrderDate], [Extent1].[DueDate] AS [DueDate], [Extent1].[ShipDate] AS [ShipDate], [Extent1].[Status] AS [Status], [Extent1].[OnlineOrderFlag] AS [OnlineOrderFlag], [Extent1].[SalesOrderNumber] AS [SalesOrderNumber], [Extent1].[PurchaseOrderNumber] AS [PurchaseOrderNumber], [Extent1].[AccountNumber] AS [AccountNumber], [Extent1].[CustomerID] AS [CustomerID], [Extent1].[ShipToAddressID] AS [ShipToAddressID], [Extent1].[BillToAddressID] AS [BillToAddressID], [Extent1].[ShipMethod] AS [ShipMethod], [Extent1].[CreditCardApprovalCode] AS [CreditCardApprovalCode], [Extent1].[SubTotal] AS [SubTotal], [Extent1].[TaxAmt] AS [TaxAmt], [Extent1].[Freight] AS [Freight], [Extent1].[TotalDue] AS [TotalDue], [Extent1].[Comment] AS [Comment], [Extent1].[rowguid] AS [rowguid], [Extent1].[ModifiedDate] AS [ModifiedDate] FROM [SalesLT].[SalesOrderHeader] AS [Extent1] WHERE [Extent1].[OrderDate] = @p__linq__0', N'@p__linq__0 datetime',@p__linq__0='2004-06-01 00:00:00' It might be quite long, but structurally that’s a pretty simple SELECT statement. The only reason it’s so large is that it explicitly requests every column required by the entity (and it has specified each column in a fairly verbose manner). The interesting part is in the last two lines. The penultimate line is a parameterized WHERE clause comparing the OrderDate to a named argument. This is what became of our LINQ query’s where clause.
Image of page 589
Image of page 590
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern