Monday, June 16, 2008

My Visions Are Coming True

OK, so I may not be Nostradamus, but in the past few weeks a few of my rants about things I want have come to pass...

Earth to HBO, Get With The Times! / March 28, 2008

HBO has started selling some of their shows an iTunes. We're still a long way from getting new episodes of Entourage within a day or two of when they air. They only have six titles for sale, none are still on the air, and not all the episodes are available, but it's a start...

Better Exchange Support Coming to Apple Mail? / March 8, 2008

This one wasn't hard to predict, but sure enough, Apple has announced that full Exchange support will be part of the next version of Mac OSX, code named Snow Leopard. This means that Apple Mail will potentially be on equal footing with Outlook when it comes to interacting with Exchange Server.

I'm sure the nay-sayers will still come up with a reason to protest, but in my mind, this knocks down one of the final barriers keeping the Mac out of mainstream business. Couple this with the push-back Microsoft is getting on Vista, and I expect Apple's market share to grow substantially in the next 3 years.

I guess it's time for me to start the speculation machine up again. I need to keep ahead reality!

Hmmmm. Let's see...... Ah, I've got one:

I predict that I will win the lottery this week.

Here's to hoping...

Tuesday, June 3, 2008

List ALL Stored Procedures in an SQL Server Database

Today I ran into a unique problem. I needed to reassign the permissions on a bunch of Stored Procedures in an SQL Server database. What a joyless task.

Now, I could do this by hand. Just open up Microsoft SQL Server Management Studio, right click on the Stored Procedure, and assign the permissions. In my case, however, I had hundreds of Stored Procedures to change. Doing this one by one would make me want to claw my eyes out.

The solution is to use some hidden system tables to get the list for me.

SELECT [name]
FROM sys.sysobjects
WHERE (type = 'P')

This gives me the list I want, but I can do a bit better:

SELECT 'GRANT EXECUTE ON OBJECT::[dbo].[' + name + '] TO [MyUserID];' AS Expr1
FROM sys.sysobjects
WHERE (type = 'P')
AND (LEFT([name],3) = 'DNN')

With this SQL, I generate the actual command needed to grand the new permissions to the Stored Procedure. I also use a WHERE condition to limit the effect to just Stored Procedures beginning with DNN, so I don't do this to everything, just the ones I want.

Once I run this, I just copy the results, paste it back into the SQL section of Microsoft SQL Server Management Studio, and execute. Bingo! My permissions have been altered.