Archive for August, 2008

scripts recovered (some)

I managed to recover some scripts this evening. But instead of uploading them to the server, I’ve copied & pasted the script into the posting itself. In future postings, I’ll upload the .sql file and embed the code/syntax into the post. This way, if in the future, when wordpress decides to nuke [...]

Saturday, August 30th, 2008

ugh!! my scripts!!!

I finally got the balls to upgrade wordpress from 2.1 to 2.6.1 and updated my download manager automatically, and it fucking nuked all my scripts along with it!!!
OMG! The damn thing should of told me what the hell it was going to do before nuking my shit. It took a long time to [...]

Friday, August 29th, 2008

GetUTCdate()

A while back, when I was working for a company in CO, I made some noise about using UTC rather then MST because the HQ was in MST zone. The reason they wanted to use UTC was because they wouldn’t have to worry about daylight saving. I didn’t like having to convert time [...]

Wednesday, August 27th, 2008

Converting datetime

Crap, I’m writing a lot today!! Someone stop me!
Okay, you run: select getdate() and got the following result: 2008-08-25 18:14:37.200
You want the result to look something like this: 08/25/2008
In order to get the result you want, you need to use the CONVERT function: select convert(varchar(11),getdate(),101)

Monday, August 25th, 2008

Union vs Union All

What’s the differences between Union vs Union All? Very simple.
Union will give you the result from two tables and remove any duplicated entries.
Union All gives you the same as Union but WILL include those duplicated entries.
Thanks for reading.

Monday, August 25th, 2008

Deleting files

I needed to delete some files from a folder on the E:\ drive via SQL. The file name looks like this like this:
20080712_200807131600_KickYourAss.dat
The 1st section shows yyyymmdd, based on that, I parsed out whatever is necessary and nuke anything that’s older than 15 days. In the script, I’ve used (select getdate() - 15), [...]

Monday, August 25th, 2008

change db ownership

There comes a time when all of your databases are owned by some retarded users or that you forgot to change the database owner after a restore. The following sproc will loop thru your databases and change the owner to ’sa.’
You can take it a step further and have it the server send you [...]

Monday, August 25th, 2008

Shrink DB script

An easy script I created to shrink files associated w/ a database. You can use the WHERE clause to fine tune what you want to shrink.

Monday, August 25th, 2008

database blocking

A script to detect any database blocking that has a duration higher than 1 min. If a blocking has a duration > 1, an email is sent, else it doesn’t do a damn thing. Enjoy.
edit 08/26/08
Updated the file with version 0.2. Added distinct function to the select statement in the HTML email

Monday, August 25th, 2008

Reporting Services - Background coloring

if you need to color code the background of a row based on the values stored in 2 or more columns, use the following code:
=iif(field!cloneStatus.Value = 1 AND field!dbStatus.value = 1, “orangered”, “white”)
This line of code basically states that if the cloneStatus and dbStatus doesn’t contain the value of 1, then set it to OrangeRed, [...]

Monday, August 25th, 2008