by Brad | Jun 27, 2014 | SQL Server
If you ever find yourself looking at a SQL server DB with no diagram, no integrity rules, and over a decade of legacy stuff lurking somewhere deep within, you may want to make use of the following two queries that will help you to find your way around and...
by Brad | Dec 10, 2012 | SQL Server
Once you have a user profile in SQL server 2008 that can send email saving something along the lines of the below as a job will attach a textfile containing the output of a query and send it to an email address in a rather tidy fashion. DECLARE @Filename...
by Brad | Dec 10, 2012 | SQL Server
So you want to update a single row in your table and then return the row identifier that was affected, here’s one way of going about it. Remember SCOPE_IDENTITY() is about inserting so as we are updating here we need a little something different. This will...
by Brad | Jan 16, 2012 | SQL Server
My usual way to find the ID of a database to reliably filter a trace running in profiler is to look through the sysobjects table in master. I found this way is far nicer select db_id(‘yourdatabasename’) DOH!
by Brad | Oct 14, 2011 | SQL Server
Perhaps there’s a point to this, but not for me today – but maybe in future or for you today? create table #t (a int) create table #A (a int, b int) create table #B (a int, b int, C int) create table #C (a int, b int, c int, D int) create table #D (a int,...
by Brad | Oct 11, 2011 | Recommendations, SQL Server
Today I found out something that I found out years ago, if you like me need to use multiple SQL servers but can’t remember things by IP address or would prefer not having to type login information every time you want to connect then use registered servers....