Run real-time SQL tracing at application level with a ORM….

If you ever need to know exactly what dml your application is running as you have an ORM as your persistence layer like NHiberate. The most effective way is to add an application name parameter to your ado connection string and use SQL Server Profiler, to listen for this application, see below:-

Change application’s ado connection string:-

“Data Source=XXXXX;Initial Catalog=XXXXXX;Integrated Security=True;Pooling=False”


“Data Source=XXXXX;Initial Catalog=XXXXXX;Integrated Security=True;Pooling=False;Application Name=GOSQL”

Go to SQL Server Profiler, start a new profile using the standard ‘SQL’ profile.

On the ‘Events Selection’ tab select ‘Show all columns’.

Select ‘Column Filters’.

Select ‘ApplicatioName’ expand ‘Like’ enter your application name, and select ‘Exclude rows that do not contain values’.

Select ‘OK’, and ‘Run’.

Any request coming through as your application name will be profiles for analyzing later.

This is a very good technique if your are trying to identify what dml the ORM is rendering under the hood. Once you have identified your the dml, you can tackle your problem with a better understanding of what the application and database are trying to do.Image

My 1st Blog – out of memory exceptions in SSDT… yes its technical

When unit testing a stored procedure in visual studio 2012 (SSDT); sometimes you can get a out of memory exception (especially if you’re retrieving over 1 million rows+). To resolve this, go to the TEST\Test Settings\Default processing Architecture menu and select ‘X64’, this will give you a massive increase in memory usage with in Visual Studio and testing.