Logging ALL Queries on a SQL Server 2008 Express Database?

SQL Server Profiler: File → New Trace The “General” Tab is displayed. Here you can choose “Save to file:” so its logged to a file. View the “Event Selection” Tab Select the items you want to log. TSQL → SQL:BatchStarting will get you sql selects Stored Procedures → RPC:Completed will get you Stored Procedures. More … Read more

How to find server name of SQL Server Management Studio

Open up SQL Server Configuration Manager (search for it in the Start menu). Click on SQL Server Services. The instance name of SQL Server is in parenthesis inline with SQL Server service. If it says MSSQLSERVER, then it’s the default instance. To connect to it in Management Studio, just type . (dot) OR (local) and … Read more

Query times out when executed from web, but super-fast when executed from SSMS

So your C# code is sending an ad hoc SQL query to SQL Server, using what method? Have you considered using a stored procedure? That would probably ensure the same performance (at least in the engine) regardless of who called it. Why? The ARITHABORT setting is one of the things the optimizer looks at when … Read more

How do I view the full content of a text or varchar(MAX) column in SQL Server 2008 Management Studio?

SSMS only allows unlimited data for XML data. This is not the default and needs to be set in the options. One trick which might work in quite limited circumstances is simply naming the column in a special manner as below so it gets treated as XML data. DECLARE @S varchar(max) = ‘A’ SET @S … Read more