Many TSQL books show you how to use @@Identity to get the identity of the most recently added row. Many articles online, or in magazines show the same. What you might not know is that it is potentially a source for some very hard to trace bugs in your application. @@Identity is potentially a very, very bad thing! In almost every case, you should use scope_identity() instead. Why? @@Identity returns the most recently created identity for your current connection. When you first use it, it might be fine. Until someone adds a trigger. If the trigger causes another identity to be...
This is as much a question as a post, so please, leave me some comments if you have the time. In the current issue of SQL Sever Magazine, Michelle Poolet has an article about "Overlapping Subtypes." I'm wondering what you all think about this. The example she uses is very similar to my own case, so I'll describe it in the best way that I can: I have a people table which of course contains basic information about people that are used in my application. Each person might perform different "roles" within the application. Such as "broker"...
Yukon article in SQL Sever Mag
The current issue of SQL Server Magazine has an article on Yukon, which is an interview with Eric Brown, a Product Manager for SQL Server at MS. It's a really fun read. Of course, I can't resist mentioning the things that I think are most cool about Yukon: TSQL isn't going away :) With all the talk about CLR integration, it was nice to see that they aren't trying to move away from real "SQL" code... Separate DATE and DATETIME datatypes. This alone will be worth the price of the upgrade for me. I can't tell you how many...
producing CSV files on the fly
Two people recently have asked me how to produce this sort of output from ASP.NET. Please note, the code here is not meant to be an example of any best practices. There are plenty of things that could (should) be done a bit differently. The listing is for the express purpose of showing how to simply get it done. Doing it the “right“ way is up to you :)
What isn't shown here is the code to get your ADO.NET DataTable object from your database. Assuming that you have your DataTable, what you need to do is turn that into a...
Arrays and Lists in SQL Server
Paschal L posted a link to this article about arrays and lists in SQL Server. It's a long read, but there are some interesting points. I just thought I'd pass it along in hopes some of you like it.
Hello everyone. My name is Travis. I'll try not to blog about my (nearly) three year old son all the time :) I'll also try not to be one of those guys who blogs ONCE, to say “Hello everyone” and never comes back.
Just so you know a little about me... I've been neck-deep in computers and programming since I was in high school in the early 80's. Yes, I started with a Commodore 64. I just knew the Amiga was the best thing ever. I hated Windows. Hated Microsoft. I programmed in “E.“ Then came Windows 95 :)
I've been Director...