Category Archives: Uncategorized

My morning so far

Ok, aside from being kinda sick still, my morning has been filled with interesting issues.  Ahhh– the life of a prod DBA. 

It started today with space issues–again.  We’re just running out of space everywhere and it’s hard to even keep some DBs running because of the problems.  So I’m having to shrink some DBs just to keep them active. 

Now this one just gets me a little.  Had a vendor come up to me to ask for help.  He was on one of the prod servers and detached 3 of the DBs and couldn’t get them back.  Turns out he had moved the files and renamed them and expected SQL to know where they were.  He said he had problems initially and that’s why he did it, but he got stuck when he couldn’t detach them again to point SQL to the new files.  So I got that worked out for him with relatively little effort.  

Now this next one is just interesting.  I just switched our backup routine on our big system to backup to 20 files.  So the dev downstairs had a routine to restore it to a different server (I didn’t know that) and his routine was bombing.  He had re-written it to use the 20 files, but it was still failing.  Now, I’ll say that doing it the way he did doesn’t make him dumb.  In fact, I could very easily see anyone making a similar mistake because to someone who doesn’t know backup intimately, it seems like the kind of thing you should be able to do.  What he did was he was building a dynamic string to hold the file name values.  So in the string he was saying something like this: 

  

SET @BackupDatabaseFileNamePath = ‘DISK = N’ + ”” + ‘\\’ + @ProdIP + ‘\’ + LEFT(@BackupDatabaseFileNamePath,1) + ‘$’ + 

RIGHT(@BackupDatabaseFileNamePath,(LEN(@BackupDatabaseFileNamePath)-2)) + ””  

And so to that end, he was ending up with a string that looked like this: 

DISK = ‘\\127.0.0.1\K$\SQLBackups\ServerName\DBName\01of20FullPRD20101102010001.BAK’, 

And he did that 20 times, once for each file.  So now his actual restore command looked like this: 

  DECLARE @file VARCHAR(100) 

SET @file = ‘c:\SSISPkgMgmt.bak’ 

RESTORE DATABASE SSISPkgMgmt 

FROM @file 

WITH replace 

RESTORE DATABASE PRD 

FROM @BackupDatabaseFileNamePathInc 

And that looks like it should work because when you print it, you wind up with a perfect backup cmd.  The problem is that the backup cmd doesn’t work like that.  It takes params, or flags if you will, right?  And one of those flags is ‘DISK =’.  That means that the flag itself is ‘DISK =’, not a string that contains that same text.  It’s a subtle difference to us, but not to the backup cmd.  So if you want to build a string like that for either a backup or a restore, then you have to build a string that contains the entire backup cmd and not just a single part that includes the params. 

Here’s an example of something you can do though: 

DECLARE @file VARCHAR(100

SET @file = ‘c:\SSISPkgMgmt.bak’ 

RESTORE DATABASE SSISPkgMgmt 

FROM @file 

WITH replace 

And what he was trying to do was this: 

DECLARE @file VARCHAR(100)
SET @file = ‘DISK = ”c:\SSISPkgMgmt.bak”’
 
RESTORE DATABASE SSISPkgMgmt
FROM @file
WITH replace

 
If you run something like this you’ll see that SQL views it as a backup device because that follows the restore syntax.

So anyway, big fun again today too.

My ridiculous day

Yeah, some days it just doesn’t pay to even try to do a good job.  Not only are my sinuses really giving me a raging headache today, but these are the ridiculous things I’ve been engaged in on top of it.

I had to tshoot an ssis pkg because it stopped working when I moved it to the dev box.  As it turns out the moron who wrote it put the values in the config file like I told him to, but he only put part of them in there.  The rest are still hardcoded in the pkg so of course it was failing.

I’m installing SQL R2 ent. on a VM with 1GB of RAM.

I turned AutoShrink back on for a DB because the business owner is scared to death it’ll blow something up if I don’t and they wanted to check with the vendor to make sure I wasn’t going to kill the DB.  Shoot me now.

I BCPd a couple large tables out to a different server and zipped them up.  I had to do this because the server is running out of space and the server team says they can’t get any more right now.  So in order to keep the DB running I’ve had to take a couple tables out of the DB so there’s room for normal ops.  This won’t end well.

Heard back from the support guy about the AutoShrink issue above.  He’s not sure but he’s pretty sure that a major change like that will void our support contract.  Really?  On the day my head is pounding so hard?  Consider yourself lucky this time.

Going to lunch soon.

Another Interview

Ok, I just got out of another interview earlier today and there are a couple good ones in here.  It’s not anywhere near as good as the last one, but you’ve gotta admit that’s a tough act to follow.  So this girl was much more business-like and she was quite nice and honestly just trying to do her best.  She was quite shy and Asian so her english wasn’t the best.  So I’m forced to interpret her answers as best I can sometimes.  So I honestly can’t tell you exactly what she said for all of them, but I’m getting the gist as best I can from the different things she want through to try to reason it out.  I typically just landed on the last thing she said and took that as her answer.

Q:  What the difference between an SP and a trigger?

A:  A trigger is a special SP that stops when you run it after a certain time.  They can only run for a pre-determined time.

Me:  Oh yeah?  Ok, so how long can they run?

Her:  It depends on how big the server is.  It’s determined by the resources.

Q:  what’s the difference between datetime and smalldatetime?

A:  Smalldatetime is limited and datetime is much more range of time.

Q:  What does sp_ in front of an SP signify? 

A:  It just means that it’s an SP.  All SPs have to be named sp_ or the system won’t read them as SPs.

Q:  What are the 2 types of UDFs?

A:  Fixed and variable.

Me:  Ummm, ok.

Q:  What’s the difference between ‘Select Into’ and ‘Insert Into”?

A:  Insert puts data into a table… select into… (she struggles with the answer and half says a couple things.  She then fades out after saying about 3 things I couldn’t understand.  None of them sounded like an answer though.)

Q:  What’s the difference between varchar and nvarchar?

A:  International support.

Q:  What’s the difference between a clustered index and a non-clustered index?

A:  Cluster is a pair index.  It’s at the server level so when something is down it’s kind of like a backup.  Non-clustered  in the only one…(something I can’t understand)… you can rely on that one and only backups can support it.

 

I then told her to give me a question to ask her.  “I want you to pick the next one.  Give me a specific question to ask you.”

And after thinking for a minute or so she comes up with this:

“What does DML stand for?”

So I asked her that question, and after fudging around for over a minute she finally came up with the right answer.  She went through many variations before landing on the right answer though.

Ok guys, that’s it for this round.

The Dumbest man on Earth -char() vs varchar()

Wow, I didn’t realize I left this question out.

So here’s the question:

Q:  What’s the difference between char() and varchar()?

A:  With char() you can store the standard set of characters.  And with varchar() you can store the extended set… pretty much any character you can think of can be stored in varchar() whereas with char() you can only store the standard 50.  I think it’s 50.  Maybe it’s 53 or something.  I forget the exact number, but it’s about 50. 

So that’s when I asked him about the difference between char() and nchar() because that usually kicks them in line and they go, oh wait, y, so char() holds regular data and nchar() holds extended data.  So that means varchar() holds… and then whatever they come up with next.

But not this guy, no, he stuck to his guns and went with nchar() holding numeric character data.

You’ve gotta love someone who sticks to their guns no matter what!

The Dumbest man on Earth -Another Short Note

Sorry guys, but I keep remembering things.

When I announced to him that the tech screening was over, he sighed and I could see 10yrs leave his face.  Come to think of it, that’s why I decided not to call him out in front of everybody and tell him he didn’t know anything… because I felt so incredibly sorry for him.  It’s like kicking a puppy until he bleeds and then laughing at him for the way he licks himself clean.

But he did ask the other team to take it easy on him because he just had a huge beating of a SQL interview.  He said that he had no idea we were going to ask him so many master-level questions, and then asked the guy how the job ad matched up with what we’re clearly expecting.

I’ll say that this whole thing is entertaining from the angle that I didn’t take him on to raise.  I’m not responsible for his knowledge or his income.  He’s clearly managed to find work all these yrs, so he’s gotta be doing something… right?  So I’m sometimes torn when I have interviews like this because I want to help these people… but I didn’t take them on to raise.  It’s not my job to teach them everything they need to know.  And while we’re feeling sorry for him let’s all remember that he’s got more time in this industry than I do and he’s chosen to not pick up any books or read any articles.  He’s chosen that himself.  So y, it’s sad that he’s that pathetic, but he brought this on himself.  I bet even dog catchers read dog catching books.

The big question is, does someone like that deserve our ridicule or our pity?  I say both really.

The Dumbest man on Earth -Follow-up

Since everyone is so interested, I thought I’d give some further observations about our favorite candidate.

1.  He was visibly shaking throughout the entire interview.

2.  He claimed that had he known there would be so many sql questions he would have studied.  He said he’d only need a couple days.  Frankly, I was VERY tempted to give it to him just out of morbid curiosity.

3.  He said that he had been concentrating on Access the past few months and that’s why he couldn’t remember any of the SQL Sever stuff.  But when I started quizzing him on Access he bombed that too.  And I only know enough about Access to barely get by.

4.  His nervous laughter wasn’t just time consuming, it was loud and annoying.  Everyone go ahead and ask Jen how much I adore loud obnoxious laughing when I’m trying to talk.

5.  He was actually pre-screened by the team doing the hiring.  I’ve since then heard that the guy who did the screening was very embarrassed that this guy turned out to be such a loser.

6.  The guy actually said he was sorry for being so disappointing.  I told him I rarely come into these things with any expectations so it’s impossible to be disappointed.  However, I did tell him I was quite pleased what what I got out of our discussion.

7.  I managed to hear a couple of the questions by the hiring manager as I was leaving and he was basically telling them that he would do whatever they wanted and was divorcing himself from any independent thought.  He wanted a job so badly.  Can you believe he’s a contractor?

8.  I knew this was going to be fun when I saw his resume claim that he had done SQL Server on VMS.

9.  One of the things I didn’t tell in the main post was that with a little prompting he WAS able to tell me the 4 basic steps to creating a cursor.  Funny isn’t it?  The only thing he got right was about how to use a cursor.  Run away very fast.

10.  After he blew the char() vs varchar() question so badly, I asked him the question about char() vs nchar().  Again the answer was I’m not sure where you’re going with that.  nchar()?  What is that, like a numeric Char()?

I’m sure there’s more in my brain somewhere, but that’ll do for now.

The dumbest man on Earth

This is one of the most incredible interviews I’ve had to date. It has plenty of very unique answers and lots of good old-fashioned awkward pause. I’m torn about how much to write down because it really gets kinda long after a while, but I’m likely to put a good deal of it though cause I know some of you will want to hang in there. So without further ado I’ll get to some Q/A.

Oh wait, I suppose I should explain the position first. I’m interviewing candidates for a group downstairs. They’re looking for a SQL guy to help them write reports, and support their current data processes and help support their new SSIS pkgs and do some SSRS stuff. He doesn’t have to know everything, but it would be nice if he had a working knowledge and could be taught. This guy has been doing this for many yrs and has a resume the size of mine. So he’s very experienced.

Q: What does sp_ in front of an sp signify?

A: It means it’s a system procedure supplied by MS.

Me: OK, and what does it do.

Him: Nothing, it just means that MS created it and gave it to you because they thought it was be useful.

Me: And can you create your own?

Him: Well of course. You can create as many as you like.

Me: So does that make them system SPs then?

Him: They’re SPs that were supplied by MS.

Me: Yeah, I got that part. How are they all supplied by MS if I can create my own? Will MS add mine to the product since I created them as system SPs?

Him: Yes. Any SP you add with sp_ will be uploaded to MS and will be included in a service pack.

Me: I don’t think I could have explained that any better myself.

Q: What are the 2 types of UDFs?

A: I didn’t know there were 2 types of UDF.

Me: Ok then.

(Now this one just boggles the mind)

Q: What’s the difference between delete and truncate?

A: I know there’s a difference but I can’t think of it. No wait, I remember. Delete deletes all the data in a table and truncate leaves space at the end.

Me: Pardon? Did you say that truncate leaves space at the end? Then end of what?

Him: Yeah, truncate leaves space but delete gets rid of all the data.

Me: Ok, so what if you only want to get rid of a few rows?

Him: That’s what you call a partial delete and you have to do that inside a transaction.

Me: Moving on…

Q: What are 2 types of cursors?

A: I know there are different types I just don’t know what they are.

(Actually one of the brighter things he’s said.)

Q: What’s the difference between Select Into and Insert Into?

A: Well, I don’t even know where you’re going with that. They’re 2 different statements and they do 2 different things. Yeah, I just don’t know where you’re going with that. It has to be somewhere though. Ok, let me think. A select statement is a query that you use to select data. And an insert you use to put data into a table. But you can use a select with an insert so I guess that makes them the same thing, so I don’t know where you’re going with that. Yeah, I just don’t know. Are you asking me if they’re different, because they’re not. Since you can use a select with an insert that makes them the same thing. Yeah, that’s right.

Me: I think you’ve misunderstood. There’s a select into statement, and there’s an insert into statement. They’re 2 different statements. I’m asking what each one does.

Him: But they’re the same thing aren’t they? Well, I mean except that one selects data and the other inserts it, but you can use them together so doesn’t that make them the same thing?

Me: Well, they both insert data, except the select into creates the table and the insert doesn’t. That’s not the only…

Him: Yeah, I know that. That’s what I was trying to say. Yeah, the select statement creates the table and the insert statement inserts data into it. Yep, that’s right.

Me: Well, that’s not entirely what I said, but let’s move on.

Him: Yeah, it’s close enough. I think we’re talking about the same thing. I’m still not sure where you were going with that though.

Q: What’s the difference between an SP and a trigger?

A: Again, I’m not sure where you’re going with this because a trigger calls an SP so that’s the difference. So a trigger is what calls an SP and the SP is what gets called. That’s the difference.

Me: Ok then. You don’t get any more succinct than that.

Q: What’s the difference between datetime and smalldatetime?

A: I’m not entirely sure what the difference is. I think that datetime only stores small dates and smalldatetime stores larger dates. No, that’s backwards. Datetime stores big dates like anything after say the 15th every month and smalldatetime stores dates from 1 to 14. Yeah, that’s right.

Me: So you’re telling me that I have to have 2 separate cols in my table for each half of the month?

Him: Well yeah. That’s why normalization is such a big deal because if you don’t create your tables properly you’ll be in big trouble because everything’ll be slow.

Me: I honestly don’t know what to say. I’ve never heard that explained in such a clear-minded fashion before. And to tie it back into normalization… just excellent.

(This is my gimme question, right? He’s done so poorly until now I really wanted him to get one.)

Q: What’s the difference between a clustered and a nonclustered index?

A: This is one of those interview questions and I don’t know where you’re going with this one either. I don’t understand this, this is one of those interview questions. This is one of those interview questions…

Me: I’m sorry, you keep saying this is an interview question, what do you mean by that?

Him: Well, this is one of those questions that they ask in every interview. And if you search for interview questions on the internet you usually come up with this one.

Me: So are you telling me that it’s purely an academic question then?

Him: No, I’m just saying that it’s a question you hear in every interview.

Me: Well, this is an interview so why don’t you answer it.

Him: Ok, well a clustered index is a global index. It’s open to everybody. And a nonclustered index is only available to certain people.

Me: I’m afraid I don’t understand.

Him: You don’t have to give permissions for a clustered index; it’s global. Everyone can see it. But for a nonclustered index you need to maintain security for it. It’s part of the MS security model.

Me: So what is it about a nonclustered index that makes you need to lock down security?

Him: I don’t know their reasoning. I just know that’s how it works.

Me: So what’s stored in a nonclustered index that makes you have to lock it down then? What info are you hiding from the general public?

Him: I’ve always wondered that. I don’t know. I just know that it makes the data more secure. That’s what all the documentation says anyway. So I don’t know where you’re going with this because this is just an interview question.

Me: Do yourself a favor and don’t say that again. I get it you think the question’s worthless.

Him: No, it’s not worthless, it’s just that it…

Me: Let’s move on before we get to the end of that sentence.

Q: Explain when you would use the ‘Having’ clause.

A: Well, ‘HAVING’ is not my forte. But it’s used when you can’t use the ‘where’ clause in the right place.

Me: When you can’t use the ‘where’ clause in the right place? I’m not sure what you mean.

Him: There are times when you can’t put the ‘where’ clause where it ordinarily goes so you have to use having.

Me: Can you name one of those times? Give me an example?

Him: Not really. That kind of thing is hard to nail down really. It’s random to begin with.

Me: Wait, what’s random?

Him: When you have to use ‘Having’. It doesn’t happen all the time.

Me: I can see how that would be hard to define something that keeps changing like that. Have you thought about asking MS to make that more stable so people know when to use it?

Him: No, I always figured it was something they couldn’t do or they would have.

Me: Would you be surprised to know that it has been stabilized?

Him: Really? When did they do that? In this last version? Cause I haven’t played with the new one yet.

Me: No, they stabilized it about 25-30yrs ago. I can’t watch you struggle through this anymore. Would you like me to give you the well-kept secret of the ‘having’?

Him: Sure.

Me: ‘Having’ is like a where clause for a ‘group by’. So if you get a result back from a ‘group by’, say you’re counting how many of each value is in a table with something like Select CustID, count(*) as CT from orders group by CustID, then that’s a result you’re getting back from a ‘group by’. You can see how many orders each customer has had. But if you want to see only customers who have had more than 100 orders, then you would add ‘having count(*) > 100’ and you’ll now only see the ones who have had more than 100 orders. So it’s really kind of a ‘where’ clause for a group by. It doesn’t move. It’s not mysterious. And there’s no secret potions or incantations you have to apply to make it work from one day to the next.

Him: Wow, yeah that makes a lot more sense. See, this is why I need to work here because I feel I could really learn from someone like you.

Me: And furthermore… I’m pretty pissed off that you would even waste my time like this. You’re clearly a complete idiot. In the 20+yrs you’ve been doing this you’ve clearly never once opened a single book. I mean, what the hell kind of moron thinks that this shit is all voodoo that nobody can understand? Computers are solid and predictable and you’re an idiot. I mean, seriously, did you really think that SPs you create get uploaded to MS and included in service packs?

Him: Well I always…

Me: Shut up. I don’t even want to know the answer. I’m afraid some of your stupid will get on me and I’ll step into the street in front of a car. I suggest you do something more suited to your intellect. Just remember, when the buzzer goes off, it’s time to pull the fries.

Ok, I made the part in blue up. I was actually very nice to him. But it sure felt good to say all that here.

So ok, that was my interview yesterday. All of these stupid answers are not only completely real, but they were compounded by his nervous laughter. So for every answer there were a couple senseless jokes and about 30-45secs of him laughing at them.

And I don’t know about you guys, but all of the stupidity aside, I find the bit about some of those being interview questions particularly puzzling and somewhat offensive. That’s implying that these questions are useless and have no place in your day to day life.

So there you go… that’s the interview as best as I can recount it. I was taking some notes while he was talking, but I didn’t do some of them justice. Hell, just not being able to convey his laughing all the time really makes you miss an essential part of the experience. And I’m doing more interviews for this group so there’ll be more coming.

Dealing with stupid customers

As we found out yesterday there’s more that one way to deal with a customer you think is stupid.  And now matter how good or bad Cornhole was is irrelevant because he still had a customer he thought was stupid.  So whether you’re right or not isn’t important.  The bread lines are full of guys who were right.  So that’s evidently not what’ll keep you your job.  Good customer service is what’ll keep you your job.  And it’s not always easy to keep your temper in check.

I expect very little of my customers.  I know that most people know almost nothing about DBs so I don’t mind when they say something wrong, or when they ask what’s thought of as a stupid question.  What bothers me though is when they claim to not know anything about DBs but they don’t believe you when you answer their questions.  No, that doesn’t sound right to me.  This is a dangerous crossroad because your next statement can determine whether you go back to your desk after the meeting, or to HR.  Typically, what I do when they don’t believe something I say is I ask them what it is about it they’re having a hard time with.  So instead of getting into a pissing contest, just find out what they don’t like.  This way you can attack their problems one by one until they have no choice but to believe you.  I say that, but we all know those customers who refuse no matter what you say.  But by attacking their issues one by one you will quite often find that they didn’t understand what you were saying so they rejected it on the Big-Word Factor.  The Big-Word Factor has 2 sides and you never know which one it’s going to land on.  The first side is what we just discussed;  people discredit what you say because they don’t understand the big word you used.  And anything they haven’t heard of couldn’t possibly work.  The other side of that can do just as much damage.  This is when someone is so impressed with your big words that they blindly follow whatever you say.  I’ve seen this cause quite a few problems because a customer likes the sound of a word and it just gets them into trouble.  Clustering is one of those words.  More people implement clustering because it sounds cool and they don’t get what they really need.

So what do you do if the customer just insists that you don’t know what you’re doing?  Well at some point you’ve just gotta say, well it’s too bad you don’t understand what I’m talking about, but this is what we’re doing because I’m the DBA and you said you didn’t know anything about it.  So why would we do what you think is smart when you claim to have no knowledge on the topic and I do?  There’s a reason you let the brain surgeon (and not your husband or your kids) operate on your mother.  And I bet you don’t understand all the words they say either do you?  And a lot of people don’t realize this, but a really good IT guy studies just as much if not ultimately more than most doctors.  And we can experiment without any kinds of moral issues getting involved.