Archive for the ‘SQL’ Category

Querying XML in SQL Server 2005+: namespaces

I recently helped a friend solve an XML problem, and thought I would post the solution here.  Although there are lots of notes on how to use XQuery in SQL Server 2005+, this was a real world scenario that was trickier than I expected.  The friend works for an insurance company broker, and in one [...]

September 1, 2010 · stuart · No Comments
Posted in: SQL, SQLServerPedia Syndication, XML

T-SQL tip: Use a role for EXECUTE permissions

If you are in a high-security environment, this may not be the best tip for you, but if you’re in a situation like mine where you have a SQL user that is connecting to a database in order to EXECUTE stored procs, and you know that user needs to be able to EXECUTE every proc [...]

July 23, 2010 · stuart · 4 Comments
Posted in: SQL, SQLServerPedia Syndication

Speaking at Atlanta.MDF on Monday, June 14

Quick  note:  I’ll be presenting my thoughts on XML and relational design at next week’s meeting of AtlantaMDF.  If you’re in the area, please come join us for free pizza and education. http://atlantamdf.com You Got XML In My Database? What’s Up With That? Tweet This Post

June 9, 2010 · stuart · No Comments
Posted in: SQL, SQLServerPedia Syndication, User Groups, XML

Speaking today: PASS AppDev Virtual Chapter

I know it’s short notice, but to be honest, I totally forgot about this until a couple of weeks ago.  I’ll be presenting today at noon eastern on a LiveMeeting for the Application Developers Virtual Chapter of PASS.  Deets below: “You Got XML In My Database? What’s Up With That?” May 11th 12:00 PM EDT (GMT [...]

May 11, 2010 · stuart · No Comments
Posted in: PASS, SQL, SQL Server, SQLServerPedia Syndication, XML

#TSQL2sDay 003: Maslow and relational design

Rob Farley is hosting the third installment of TSQL Tuesday, and it’s a fun one: relationships (in honor of Valentine’s Day).   While I’m not currently in much of a mood to opine on the virtues of love and databases, I did think I wanted to post something a bit more esoteric this time.  Not many [...]

February 9, 2010 · stuart · 2 Comments
Posted in: SQLServerPedia Syndication, TSQL2sDay

#TSQL2sDay 001: Date/Time Issues and Data Modeling

This is my first post for T-SQL Tuesday (thanks, Adam, for the idea!); I’m hoping this will be a continuing block party, and hopefully connect a lot of us SQL bloggers together.  There’s a lot of great content out there, and sometimes it’s just tough to find. Just a few notes before I get started [...]

December 8, 2009 · stuart · One Comment
Posted in: TSQL2sDay

Good Habits To Adopt: Enforcing the natural primary key

I’ve been reading Aaron Bertrand’s great series of blog posts on bad habits to kick, and have been thinking to myself: what are some good habits that SQL Server developers should implement?    I spend most of my day griping about bad design from vendors, yet I hardly ever take the time to document what should [...]

October 22, 2009 · stuart · 3 Comments
Posted in: Good Habits, SQL, SQLServerPedia Syndication

<facedesk>

So, I’ve been answering questions on StackOverflow for two days now, and I still like the experience.  However, I have noticed a disturbing trend in several of the questions being asked that involve SQL Server.  Here’s an example of one; I’ll give you the question, and my answer, and then tell you what’s bugging me. [...]

October 8, 2009 · stuart · 3 Comments
Posted in: SQL, SQLServerPedia Syndication

Building ranges using numbers

A while back, I posted a solution to a problem I was facing where I needed to generate a table of ranges.  While I haven’t experienced any sort of issues with the solution, a couple of things have recently occurred which has caused me to go back and take a look at the problem, and [...]

September 27, 2009 · stuart · No Comments
Posted in: SQL, SQL Server, SQLServerPedia Syndication

FizzBuzz

Stumbled across Mike Hillwig’s post in response to a question posed by Brent Ozar.  Depending on how literally you want to use the word “print” (do you mean the actual command, or do you just want output?), I think I have a slightly more elegant solution than what Mike proposed. SELECT CASE WHEN n%3=0 AND [...]

September 27, 2009 · stuart · No Comments
Posted in: SQL, SQL Server, SQLServerPedia Syndication