Browse by Tags

All Tags » sql (RSS)

T-SQL Tuesday #003 (Relationships): The round-up

Lots of blog posts for this month, for the first T-SQL Tuesday to leave the safe-haven of Adam Machanic’s blog . Some people obviously missed out, probably because they don’t read this blog, but I guess that’s the nature of the meme...
Posted by Rob Farley | with no comments
Filed under: , ,

The Query Optimizer’s handling of Relationships for T-SQL Tuesday #003

I’m feeling the pressure for this month’s T-SQL Tuesday , probably because I’m also the host. I’ll be posting a roll-up for it soon too, which I’m sure will be great fun researching. Given that the topic is on relationships...
Posted by Rob Farley | 4 comment(s)
Filed under: , ,

Invitation for T-SQL Tuesday #003: Relationships

It’s time for the third of Adam Machanic’s T-SQL Tuesdays, and this time, I’m the host. The first one , last December was on the topic of date/time, and the second was on Puzzling Situations. Check them both out, along with the round...
Posted by Rob Farley | 18 comment(s)
Filed under: , ,

A CASE study in SARGability

A recent discussion on Twitter about a query that Denny Cherry was looking at led to this post by Josef Richberg: http://josef-richberg.squarespace.com/journal/2010/1/28/is-a-case-statement-considered-sargable.html , and I thought it might be worth going...
Posted by Rob Farley | 3 comment(s)
Filed under: ,

SARGable functions in SQL Server

SARGable is an adjective in SQL that means that an item can be found using an index (assuming one exists). Understanding SARGability can really impact your ability to have well-performing queries. Incidentally – SARGable is short for Search ARGument...
Posted by Rob Farley | 4 comment(s)

T-SQL Tuesday - HAVING Puzzle answer

Earlier today you may have seen a blog post of mine about a puzzle involving HAVING . You should read that post before this one. It was part of Adam Machanic’s T-SQL Tuesday meme. The question was about the query: SELECT 'No Rows' WHERE 1=2 HAVING...
Posted by Rob Farley | 4 comment(s)
Filed under: , ,

T-SQL Tuesday - T-SQL Puzzle with HAVING

Adam ’s hosting another T-SQL Tuesday, for which this post is jumping in. He’s themed it around T-SQL Puzzles , which I found quite interesting, because the world is full of them. Most of the questions that I answer on forums, help sites, and so on, are...
Posted by Rob Farley | 4 comment(s)
Filed under: , ,

Foreign Keys against Views

Foreign Keys are great. For those of you who read some of my other posts, or heard me present on this material before , a foreign key can really help the Query Optimizer simplify out your query, because it knows that it must be able to find a match in...
Posted by Rob Farley | 6 comment(s)
Filed under: , ,

Apostrophes around column aliases

Far too often I see SQL code which uses apostrophes around column aliases, like this: SELECT ProductID, SUM(LineTotal) AS 'Total' FROM Sales.SalesOrderDetail GROUP BY ProductID; This is fine, but the worrying thing about this is if the user decides...
Posted by Rob Farley | 1 comment(s)
Filed under:

Useful SQL Question and Answer sites

There are so many places to ask a question these days. I get plenty of questions via MSN Msgr and email, and do my best to answer those of course. But there are many others too. I figured I’d list some of the ones that I frequent, and challenge...
Posted by Rob Farley | 2 comment(s)
Filed under: ,

Infinite Drill-through in a single SSRS report

Grant Paisley of Angry Koala and Report Surfer put me onto this a while back, and I have to admit I’m a bit of a fan. The idea comes from the fact the way that SQL Server Reporting Services (both 2005 and 2008) handles parameters with Analysis Services...
Posted by Rob Farley | with no comments

High ROI items for SQL Server 2008

To persuade your boss to embrace an upgrade to SQL 2008, you need to know which features have high Return On Investment. They may have seen presentations talking about features like Spatial, or MERGE (and been quite impressed), but they may well have...

T-SQL Tuesday – A date dimension table with computed columns

Quite a few people have asked me to blog about what I do for a date dimension table. I’m talking about a table that Analysis Services references for a Time dimension. It’s going to contain every date in a particular range, and be flexible...
Posted by Rob Farley | 2 comment(s)
Filed under: , ,

Dangers of BEGIN and END

I’ve presented this material at three conferences recently, so it’s about time I wrote a blog post on it... As programmers, we love modularisation – even in the SQL space. We make stored procedures, views, and functions to encapsulate our code. This improves...
Posted by Rob Farley | 1 comment(s)
Filed under: , , ,

StreamInsight talk coming up at SQLBits

My talk on StreamInsight is up next. I’ll try to blog more about that later. For now, I want to mention more about SQLBits itself. This is by far the largest SQL-only conference I’ve attended (I haven’t been to SQL-PASS yet), and it’s great to be involved...

More SQL Conferences coming up, including SQL Bits and SQL Down Under

I know I won’t be there, as I’m a million miles away in Australia, but being from the UK myself, I always have an interest in the UK SQL community and in particular, events like SQL Bits. This is the fifth SQL Bits conference , and they keep getting larger...

Still learning… foreign keys don’t need to reference a primary key

…but you should still have a primary key on every table of course. It’s just that I only recently discovered that you can have a foreign key that references something else, so long as it’s known to be unique through a unique index / constraint. The scripts...
Posted by Rob Farley | with no comments
Filed under:

SSRS: Removing the Navigation link using an Expression

There are times when you want to have a Navigation property of a textbox (typically providing a link to a URL or other report), but you don’t always want the link to be there. Sometimes you just want it to be an ordinary textbox. This particularly applies...
Posted by Rob Farley | with no comments
Filed under: ,

Counting consecutive instances with DENSE_RANK

It’s hard to think of a practical use for DENSE_RANK(), but here’s one. It’s one of the ranking functions that was introduced in SQL Server 2005, along with RANK(), NTILE(n) and the incredibly useful ROW_NUMBER(). But apart from producing reports, it...
Posted by Rob Farley | 2 comment(s)
Filed under:

The new brand is Microsoft SQL Azure

It used to be SQL Server Data Services. Then SQL Data Services. Then we started hearing about SQL Services, and now (I hope finally), we have Microsoft SQL Azure instead of SQL Services, and the Microsoft SQL Azure Database instead of SQL Data Services...
Posted by Rob Farley | 1 comment(s)
Filed under: ,
More Posts Next page »