I'm not sure if this is the right forum to ask this in, sorry if it isn't. It's been a while since I've been to this site.

We have a MS SQL database that contains a table with some columns that are no longer used (or shouldn't be). The data isn't updated anymore and has been moved to different columns to extend functionality with the applications that access the data.

Anyway, I would like to remove the columns, but I need to make sure that the ASP.NET website, an Access database and a C# WinForms application don't have any code that references these columns, lest there be an error with downtime to correct it.

I know it's a generic, and complicated question, but what are some suggestions on removing these columns safely while trying to prevent unforseen errors with the applications that access the table. Because there are 3 different applications, and some of them are rather complex, I'm worried that simply searching source code for references won't be enough to catch everything.

Any thoughts or ideas?

I have a few thoughts on this.

  1. The columns have names. Search the project for references. If none, almost good to go. But don't delete.
  2. Don't delete, rename. That way you have a fast undo if you didn't catch it in line 1.

  3. Now for the big question. Is the company prepared with the Disaster Plan? The server goes up in smoke or drowns in a flood. I've found that either they have no plan and just hope nothing goes terrible wrong or get irate that anyone would every ask.

There is also the possibility that some programmer wrote code that accesses the columns in a recordset by number rather than by name. I've seen it done more than once by someone new to DB programming.

commented: Thanks. Something I never coded like that. I guess there's always someone that will find a way. +14

Good points rproffitt! The typical disaster plan here is unwritten and typically goes like this:

"Oh crap! There's a problem! Quick! Restore a backup!" Amazingly it works more often than I would care to admit.

Reverend Jim -- You mean something like this:

columnIndexHell.png

I'm literally in column index hell with this! There's even an obsolete message associated with the method used! It's making me crazy.

commented: If this is so, can't delete columns yet. +14

The stuff I was referring to was code from way back (circa 2000). The offending code was written using ADO. This was before all the interface objects like Readers came into use. I have to admit that I would rather use low-level objects like ADO and such than all of the more abstracted objects. I prefer getting my hands dirty.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.