About Jeremiah

I'm a senior database administrator with Cass Information Systems, a SQL Server MVP, director-at-large with PASS, and I also help out with my local chapter and the Application Development virtual chapter.

You can learn more about me or contact me directly.

Links for the Week of 2009-01-30

SQL Server
Set based random numbers George Mastros points out that generating a random number using RAND() in a set-based operation will always return the same value for every row in the result set. What’s a DBA to do? Luckily, George also covers a great way to get around this predicament.
Hardware for SQL Server 2008 Andrew [...]

Calendar Table? Yes please!

I finally got sick of not having a calendar table, so I went ahead and made one today. It’s nothing special and it really didn’t take much time, but I thought I would go ahead and share my script in the hopes that google will index it and somebody won’t have to think about it:

CREATE [...]

Grant EXECUTE Permissions on all Stored Procedures to a Single User

I have to run similar code on a regular basis, so I thought I would share it with everyone.
Basically, it grants access on every stored procedure that meets a certain naming pattern to a single user.

– I’ve updated this with Aaron Bertrand’s suggestions from the comments.
– Thanks to Aaron for helping make this better!
DECLARE @sql [...]

Retrieve the top X random rows from a query

Let’s suppose for a minute that you want to retrieve the top x number of rows from any given query. Keep in mind that x is a value that your users can supply.
Sure, you could do string concatenation and EXEC sp_executesql ‘SELECT TOP ‘ + @count + ‘ x FROM y;’. But, then again, a [...]

Links for the Week of 2009-01-23

SQL Server
Top 10 Interview Questions to Ask Senior DBAs Brent Ozar poses some great questions to ask DBAs (and that you might be asked as a DBA) during an interview. These are the good kind of interview questions, not the “how would you do XYZ” kind of questions. (My default response to the XYZ questions [...]