Blog ala Vidar

SQL, AppFrame and other cool technologies

Monthly Archives: June 2009

News from Ølen and stuff that matters

Quite a lot has happened in Ølen lately. We’ve had visitors, moved to other departments etc.

Most important thing first; I’ve (been?) moved from the technology department to 3E (Trygve Haaland). This means (in theory) that I’m no longer the DBA for Omega’s main database, support for R3 or similar. My new responsibilities will be supporting Trygve’s team with any of their projects. I’m sure there will be plenty of technical challenges but first I want put my focus on quality. Quality can always be improved and we will look into every corner for ways of improving both existing applications and our every day performance. This includes using the latest builds, going through QA-lists, helping each other with best practices and making sure that what we build is tested at all times. I’m not saying I’m better than anyone else making building projects with good quality, but as some of you may know, I’ve got a big mouth and I’m not afraid to use it J Therefore I think I’m pretty good at making OTHERS delivering quality projects. This will hopefully make us better at reporting bugs to the technology department, and trying to get them to deliver with the same quality as us. So, in the long run, we’ll all hopefully deliver the best of the best, not just the best!

So, who’s going to support you now? JanCB has taken over for me several months ago. He’s responsible for all support. But, if you got DBA-related questions, PLEASE send them to me! You probably already know I LOVE databases. If MSSQL was a lady, I’d already asked her to marry me!

I’m not the only one who’s moved. Johnny and Øystein have moved to Kiwi where they’ve started a “PIMS R3” team. There have been some rumors about creating a new department for them, but this is not settled yet. Along with them, Jan Leon has moved to Gassco for a couple of months. Hopefully, he’ll be back in Ølen soon. I miss my smoke-buddy. Audun Habbestad is also a part of Johnny’s team, along with Vadim, Lina and a couple of other guys from Lithuania. Sorry if I forgot to mention anyone. I’m not sure who’s a part of this team and who’s not.

So, who’s left in technology?
JanCB – responsible for support, servers, internal MarketMaker etc.
Torgeir – TeamDoc
Peter – The big chief
Georgij – Web guru
Tomas – CR3 guru

Other news? Jarl Erik is back in business. I’ve got permissions from Håvard Matre to borrow him a couple of days to work with blogs.appframe.com. If you’ve got suggestions on how to make this site better, please tell me and we’ll fix it!

Jekaterina, or Kate as we call her, have been on “my” team since she started in Omega. We’ve worked with various stuff, such as CR1/CR2 bugs, database related tasks, personnel planning etc. Lately I’ve also had the pleasure of working with Kai. What struck me with them is that they always try their best to figure out stuff on their own before asking questions. This is something the rest of us can learn from. I know I’ve got a tendency to ask Torgeir or Jan Leon if I’ve got any tricky things BEFORE trying to figure things out for myself. Note to self: Learn to keep my mouth shut for more than 5 seconds.

The last month I’ve also worked on a cool project with .NET CE (compact edition) on handheld computers. A customer wants to be able to keep track of deposits of tools in a tool store. To do this they want to use a handheld computer to scan bar codes, instead of manually inserting a lot of numbers. This has given me a good chance to get to know CE. My first comment about this is its lack of features. For example, if you want to be able to sort a listview by clicking on the column headers, you need to make this feature yourself. .Sort isn’t a method on the listview control in CE.

LIKE vs. =

There’s been quite a lot of changes in Ølen lately, but I’ll write more about that in a couple of days. Today I’ll tell you a couple of things about LIKE vs. = (equals). I got a phone call from Sigmund (btw, he’s much better now 🙂 today where he asked me why the following queries gave two different results:

SELECT something WHERE something = ‘string’
SELECT something WHERE something LIKE ‘string’

The first returned two records, while the second returned one. Strange? My first thought was unicode, but I didn’t actually know what happened here. The first record was ‘string’, while the second was ‘string ‘ (with a trailing space).

After some reading I found out that = removes trailing spaces. Just try for yourselves:

SELECT 1 WHERE CAST('a' AS VARCHAR(10)) = CAST('a     ' AS VARCHAR(10))
SELECT 1 WHERE CAST('a' AS VARCHAR(10)) LIKE CAST('a     ' AS VARCHAR(10))

Note that here we’re comparing ‘a’ to ‘a     ‘ (five trailing spaces)

SELECT 1 WHERE CAST('a     ' AS VARCHAR(10)) = CAST('a' AS VARCHAR(10))
SELECT 1 WHERE CAST('a     ' AS VARCHAR(10)) LIKE CAST('a' AS VARCHAR(10))

Now we’ve switched places. We’re comparing ‘a     ‘ to ‘a’. Suddenly it removes the trailing spaces on the left for both = and LIKE. Try changing to NVARCHAR instead of VARCHAR.

The conclusion is that when comparing strings it will always remove trailing spaces the left side, but only when using = on the right side.

EXCEPT if you’re using unicode 😀 When using LIKE on unicode it will not remove trailing spaces on either side! Confusing? Welcome to my world 🙂