﻿<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>Ayende @ Rahien</title><link>http://ayende.com</link><description>Ayende @ Rahien</description><copyright>Copyright (C) Ayende Rahien  2004 - 2021 (c) 2026</copyright><ttl>60</ttl><item><title>Gian Maria commented on Legacy ETL solutions</title><description>Working with legacy db is somewhat a "panic". Just the last week I did the very same modification you did, adding a nullable column as last column of some table to add a unique primary key, and this broke some code that is doing INSERT without specifying names of the columns, so adding a column broke the insert :(

This is a very similar problem mentioned by Steve, I saw databases with tons of views, and SELECT * in all the view....

</description><link>http://ayende.com/132097/legacy-etl-solutions#comment9</link><guid>http://ayende.com/132097/legacy-etl-solutions#comment9</guid><pubDate>Wed, 16 Nov 2011 08:26:17 GMT</pubDate></item><item><title>dotnetchris commented on Legacy ETL solutions</title><description>Collation keys FTW.

Did not (atleast off hand) know about the rowversion. Will have to remember that one if I need to ever implement change tracking in SQL to make sure rows haven't changed prior to my pending update.</description><link>http://ayende.com/132097/legacy-etl-solutions#comment8</link><guid>http://ayende.com/132097/legacy-etl-solutions#comment8</guid><pubDate>Mon, 14 Nov 2011 18:07:43 GMT</pubDate></item><item><title>Gilligan commented on Legacy ETL solutions</title><description>This is great information! I did not know about the rowversion data type. That won't have saved quite a few headaches in the past.</description><link>http://ayende.com/132097/legacy-etl-solutions#comment7</link><guid>http://ayende.com/132097/legacy-etl-solutions#comment7</guid><pubDate>Fri, 11 Nov 2011 16:53:52 GMT</pubDate></item><item><title>Steve Sheldon commented on Legacy ETL solutions</title><description>I worked on a dev project where one day the offshore team called us up and said "Hey, your data changes broke our code".  Turned out that they were doing SELECT * with ordinal numbering on a multi table join.

We had a nice discussion about why it's important to use column names in your SELECT.  Especially since they only needed about 10 fields out of 50.  :-)</description><link>http://ayende.com/132097/legacy-etl-solutions#comment6</link><guid>http://ayende.com/132097/legacy-etl-solutions#comment6</guid><pubDate>Fri, 11 Nov 2011 15:20:47 GMT</pubDate></item><item><title>Ayende Rahien commented on Legacy ETL solutions</title><description>Damien,
Yes, that is fairly accurate case of where this can break. It can also break if they are making assumptions over the number of columns involved.
In that particular database, there are _so many_ columns, that they are always using column names, if only to reduce the data loaded, so that isn't a real issue</description><link>http://ayende.com/132097/legacy-etl-solutions#comment5</link><guid>http://ayende.com/132097/legacy-etl-solutions#comment5</guid><pubDate>Fri, 11 Nov 2011 12:55:39 GMT</pubDate></item><item><title>Chris Shaffer commented on Legacy ETL solutions</title><description>@Karep - that is the reason for the 3rd rule; If you were to have a query like the following, then the ordinal numbering would change for the columns included in AnotherTable and AndAnother:

SELECT *
FROM TableWithAddedColumn
    JOIN AnotherTable ...
    JOIN AndAnother ...

</description><link>http://ayende.com/132097/legacy-etl-solutions#comment4</link><guid>http://ayende.com/132097/legacy-etl-solutions#comment4</guid><pubDate>Fri, 11 Nov 2011 12:28:17 GMT</pubDate></item><item><title>Karep commented on Legacy ETL solutions</title><description>@Damiem: Doesn't ADD COLUMN add column at the end/after all columns? Then it can't break anything even if someone is consuming values from resultsets using ordinals.</description><link>http://ayende.com/132097/legacy-etl-solutions#comment3</link><guid>http://ayende.com/132097/legacy-etl-solutions#comment3</guid><pubDate>Fri, 11 Nov 2011 11:59:06 GMT</pubDate></item><item><title>Damien commented on Legacy ETL solutions</title><description>Previous post had some of my stars (**) eaten in the second line, hopefully you can work out where.

Incidentally, I'd never recommend that code be written where those first two circumstances are true, but if this is legacy code, who knows?</description><link>http://ayende.com/132097/legacy-etl-solutions#comment2</link><guid>http://ayende.com/132097/legacy-etl-solutions#comment2</guid><pubDate>Fri, 11 Nov 2011 11:33:31 GMT</pubDate></item><item><title>Damien commented on Legacy ETL solutions</title><description>"An operation that it is safe to make since it can't break..." - that may be true with the current system, but isn't generally true. Under a combination of 3 circumstances, it isn't safe:

One or more consumers of result sets access values using the ordinal position of the columns in the result set
The result set is constructed using "SELECT *" (or at least, "t.*", where t is the name of the table you're adding the columns to or an alias of such)
The table isn't the "rightmost" table in the FROM clause.

If all of those are true, then these new columns will cause existing columns in the result set to move, and the consumers will be misaligned.</description><link>http://ayende.com/132097/legacy-etl-solutions#comment1</link><guid>http://ayende.com/132097/legacy-etl-solutions#comment1</guid><pubDate>Fri, 11 Nov 2011 11:31:15 GMT</pubDate></item></channel></rss>