Brett Kaiser (x002548) Blog

Not Just a Number - Brett Kaiser

Ghost records…..ooooooo….scary

OK, Gotta admit to being floored by this. First I would like to know how many people have heard of this. Second I would like to go on to describe what this is, how it happens, and how your Ghosts are exorcised. Read more →

Database Design based on existing data

I really like to avoid doing database design based on existing data structures. I really prefer to start with a functional flow of the business, target the data (be it existing electronic data, memo;s, post it's, whatever, data is data) for each function, organize all the data across functions into general entities, then take all of the data elemets or attributes and associate them with the higher level Entities. Read more →

SUBSTRING with Delimiters

I've been having to parse DB2 Load Cards and to extract a lot of data (Like starting postion, Length, Column name, ect) you need parse the data out of the card based on delimiters. Read more →

Fun with Dates (Date Conversion examples)

Update: 11/19/2009 No! Not that kind of fun with your date. It seems lately a lot of Date conversion questions have been popping up. So I'd thought I'd list them all here with their solutions and the author that has supplied them. Read more →

Remove a User From All Databases on a server

I'm sure Nigel or Tara alread have blogged this, but it was asked for and I scratched one up.Anyone have any horror stories with something like this? EDIT: If you look in that thread, you'll see Pat Phelan's use of sp_MSForEachDb. Read more →

Find a word in a string

By doing this with an identity Column on the row, you have a pseudo array for sql server. This user defined function will grab the nth occurance of a word in a string. Read more →

Object Dependency Hierarchal Relationships

This always seems to pop as well. To determine what objects are dependant on what you can use sp_depends. Unfortunately that's for 1 level of relationships in either direction (to the parent or the child). Read more →

CREATE TYPE2 UNIQUE WHERE NULL INDEX

This pops up every so often, as it does Here. The post title is the DB2 syntax for achieving a unique index that allows for nulls. I always felt that since Nulls are not equal to anything, not even themselves, then how could you get a dup key violation. Read more →

Show me The TOP n Number of things based on a key

OK, another one that seems to be often asked, and I'm sure there's a SQL Team article out there...I'm just lazy. Anyway, this post got me interested in this again (and I always have trouble trying to remember the answer), so I decided to post some solutions, so I don't have to remember. Read more →

Mimic Oracles INSTR Function

Starting at a user defined location in a string to find the nth occurance of a target string's starting location EDIT: OK, I got Jay's set based method to work. And I mistook Jay for Jay White (Page47) but I was wrong (but I should be given a pass, because it's just like what Mr. Read more →

But MOM! Do I have to use sp_executesql

OK, it seems often asked how to return values from dynamic sql. My initial reastion was to do something like the following. Which works, is flexible, is highly dynamic, and does take a bit of setup Read more →

Search SQL Server for a table in any databse

I've seen recently a lot of people with quite a proliferation of databases on a single server. I'm not sure why this is, but it may be a “personalized” database per client, so each client has their own replica of a database for an application. Read more →

Build a Comma Delemited String For All Rows

Seems to be a popular question people seem to look for. I Still don't know why. Kinda hard to perform set processing against data put in this form. I forget the first day I saw this, or from whom, but I always reference this article on the great SQLTeam Site. Read more →

Real World SQL Server Disaster Recovery

Just got an email from http://www.sql-server-performance.com/default.asp And they had a great link to an article from Brian Knight that discusses Disaster recovery and is “A Survival Toolkit for the DBA“. It even comes with a bunch of scripts already written. Read more →