Brett Kaiser (x002548) Blog

Not Just a Number - Brett Kaiser

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 →

Fair or Fowl?

I think I'll have the Chardonay with that. But I don't know what to think when Fabian Pascal makes a reference to SQLTeam http://www.tdan.com/sms_issue31.htm And doesn't reference the responses in that thread 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 →

Datatypes: CHAR, VARCHAR and VARCHAR2

HUH? VARCHAR2? You gotta love Oracle...ANSI be damned. Well I never specifically knew why we needed to used varchar2 during the last several projects we were on. Mostly because I was told to. 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 →

Weekend and Holidaze

Wow...it's been 2 months... It seems there's a common question discussiong how to eliminate holidays (and weekends) from date ranges. And since I'm sick of doing a search to find it, I'd thought I'd post it. Read more →

DB2 SET UPDATE

No cursors please! DB2 syntax varies from SQL Server. Just because it took me an hour to find it....I wish the syntax would be the same...but they're not  UPDATE ASSESS_AUDIT A1  SET FIRST_NAME = (SELECT SUB_FIRST_NAME  FROM ORG_TREE O1  WHERE A1. Read more →

What Happened to my DATA?!?!!?!?!?

What did YOU do! I lost All MY Work! Sound familiar? I always love it when they blame the database. User or Developer, it doesn't matter, you and the database will ALWAYS be the first one to be blamed. Read more →

Bi-Directional Updates - No Thanks

So who really wins?  Well I guess the answer would be no one (or the last one, or the one who bribes the dba...)  In any case, it was an exercise I alway contemplated, and always thought wasn't really a good idea, but always seems to come up. Read more →

The Official XML Ranting Site

XML RANT EDIT: 1/12/2005 Hey Look! An Official He-Man XML Haters Club Thread  http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=44577 Until someone can post some reason why XML in SQL Server is a good thing, I'm starting this Official XML Ranting Post. Read more →

A "Non IDENTITY" IDENTITY Column

2 things, 1st, it's not the margartias and 2nd, anything that reads SOX sucks...I gotta read...  Here's the post by Derrick Leggit (to quit?) http://www.sqlteam.com/forums/pop_profile.asp?mode=display&id=5635 And his article http://weblogs.sqlteam.com/derrickl/archive/2004/06/28/1682.aspx Read more →

SQL SERVER TOP 10

The Top 10 questions asked (and answered) at SQL Team. ALL helpf appreciated, and suggestions on the order of importance...  10. Where the Hell is Rob 9. Where is Part 2 of More Trees and Hierarchy Read more →

Thanks

I just had to post this... http://www.dbforums.com/t1001863.html And as far as Thanks Go, It's to SQLTeam... Best G-damn site on the planet Rob, Nigel, Damain, Arthur, Bill, Tara...Damn the list is too long. Read more →

Export out entire database

For some reason this seems to be the season for people needing to dump a database to text....  Well Here's one way...should rewrite it to use INFORMATION_SCHEMA, but it works well enough. Read more →

Surrogate Keys….The Devil’s spawn (OK Not really)

Always seems to spark a very heated debate…So I’d like to make a list of Pros and Cons that I’d like to keep Adding to. All comments appreciated. So I’ll start with the CON’s, mostly because I believe there are a few reasons for a surrogate key, but it is usually WAY overused and also gets dbas/developers in more trouble . Read more →

TQL?

Huh? What is TQL? A new query language...Tequila Query Language perhaps? Nope. A SQL Server Template. When I'm not stealing code, I'll use a template to get sprocs going. For the most part, Error Handling in a sproc is the same (well for me) 99% of the time. Read more →

Dynamic Predicates?

Always seem to asked...bugged the hell out of me..The answer always seemd to be dynamic SQL since anything in the predicate to handle the absence of a criteria would cause a scan of the index. Read more →