473,602 Members | 2,751 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Delete Columns with 0 value

I have been given a database with 2,944 tables in it. Each table has
35 rows and columns labeled Dur, 20, 21, 22, 23, 24, 25, 26 ..... 64,
65. They contain insurance rates by age and band.

Currently all the tables are the same length and width. I need to go
through all 2,944 and delete out any colmn with a zero value. For
some that might be columns 64 and 65, for some 50 through 65, or any
other possible combination.

If I have to open 2,944 tables individually, I'll cry. Is there a way
to cycle through the tables and look for columns with a 0 value and
delete them with VB?

Thanks in advance,
Laura
Jun 27 '08 #1
3 1664
On Sat, 10 May 2008 08:28:51 -0700 (PDT), musicloverlch
<lh****@gmail.c omwrote:

That's a HORRIBLE database design, but that aside. Off the cuff you
can do something like this:
public sub FixIt()
dim db as dao.database
dim td as dao.tabledef
dim fld as dao.field
set db=currentdb
for each td in db.tabledefs
for each fld in td.fields
DeleteIfNeeded td, fld
next fld
next td
end sub

private sub DeleteIfNeeded( td as tabledef, fld as field)
if dcount(fld.name , td.name, fld.name & "<>0") 0 then
td.fields.delet e fld.name
end if
end sub
>I have been given a database with 2,944 tables in it. Each table has
35 rows and columns labeled Dur, 20, 21, 22, 23, 24, 25, 26 ..... 64,
65. They contain insurance rates by age and band.

Currently all the tables are the same length and width. I need to go
through all 2,944 and delete out any colmn with a zero value. For
some that might be columns 64 and 65, for some 50 through 65, or any
other possible combination.

If I have to open 2,944 tables individually, I'll cry. Is there a way
to cycle through the tables and look for columns with a 0 value and
delete them with VB?

Thanks in advance,
Laura
Jun 27 '08 #2
rkc
musicloverlch wrote:
I have been given a database with 2,944 tables in it. Each table has
35 rows and columns labeled Dur, 20, 21, 22, 23, 24, 25, 26 ..... 64,
65. They contain insurance rates by age and band.

Currently all the tables are the same length and width. I need to go
through all 2,944 and delete out any colmn with a zero value. For
some that might be columns 64 and 65, for some 50 through 65, or any
other possible combination.

If I have to open 2,944 tables individually, I'll cry. Is there a way
to cycle through the tables and look for columns with a 0 value and
delete them with VB?
You should cry anyway because what you have been given is not a
database, it's a big pile of dung. Your current task is apparently
to pile it higher.

From the tiny bit of information in your post and what little I know
about the insurance business I would say you should be looking at a
single table with 4 columns to hold the whole pile.

InsuranceRates( Age, Rate, PercentAbove, PercentBelow)

Getting the information from your 2944 tables with 35 rows and a
ridiculous number of columns into that one table could in fact be scripted.

That would make your life much easier and probably triple your currently
available thumb twiddling time.

The answer to your original question is yes, but I wouldn't want to show
you how because it's a waste of time.



Jun 27 '08 #3
On Sat, 10 May 2008 12:40:10 -0400, rkc <rk*@rkcny.yabb a.dabba.do.com>
wrote:

I fully agree, but figured that if they got to 2944 without realizing
this, we might have to chalk them up in the Lost Cause column.

-Tom.

<clip>
>
You should cry anyway because what you have been given is not a
database, it's a big pile of dung. Your current task is apparently
to pile it higher.

From the tiny bit of information in your post and what little I know
about the insurance business I would say you should be looking at a
single table with 4 columns to hold the whole pile.

InsuranceRates (Age, Rate, PercentAbove, PercentBelow)

Getting the information from your 2944 tables with 35 rows and a
ridiculous number of columns into that one table could in fact be scripted.

That would make your life much easier and probably triple your currently
available thumb twiddling time.

The answer to your original question is yes, but I wouldn't want to show
you how because it's a waste of time.

Jun 27 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
3603
by: php newbie | last post by:
I am getting error messages when I try to delete from a table using the values in the table itself. The intent is to delete all rows from TableA where col_2 matches any of the col_1 values. DELETE FROM TableA FROM TableA x INNER JOIN TableA y ON (x.col_1 = y.col_2) Error msg: The table 'TableA' is ambiguous. Can this be done with SQL or should I use T-SQL with cursors here?
16
3863
by: robert | last post by:
been ruminating on the question (mostly in a 390/v7 context) of whether, and if so when, a row update becomes an insert/delete. i assume that there is a threshold on the number of columns of the table, or perhaps bytes, being updated where the engine just decides, screw it, i'll just make a new one. surfed this group and google, but couldn't find anything. the context: we have some java folk who like to parametize/
8
25051
by: John Baker | last post by:
Hi: Access 2000 W98! I have a table with numerous records in it, and am attempting to delete certain records that have been selected from it. These are selected based on the ID number in a different table. While I am using the tools in Access for query setup, its easier to show it on here using the SQL for the query, which is as follows( the table is ): DELETE .date, .,
4
59301
by: Prince | last post by:
Hi All, Can anyone tell me how to Insert,Update and Delete a record into already existing DataTable? Looking forward for the reply... Thanx in advance... Regards,
1
1922
by: Jürgen Bayer | last post by:
Hi, I just tried out the ObjectDataSource of ASP.NET 2.0. A simple application works with a GridView bound to an ObjectDataSource. The ObjectDataSource is set to a (factory) class (PersonFactory) with static methods (Select, Update, Delete, see below). The factory methods work with instances of a simple class (Person, see below). Select and Update works, but the Person object passed to the Delete method is always empty (Id == 0;...
6
3846
by: polocar | last post by:
Hi, I'm writing a program in Visual C# 2005 Professional Edition. This program connects to a SQL Server 2005 database called "Generations" (in which there is only one table, called "Generations"), and it allows the user to add, edit and delete the various records of the table. "Generations" table has the following fields: "IDPerson", NamePerson", "AgePerson" and "IDParent". A record contains the information about a person (his name, his...
0
1379
by: Gammazoni | last post by:
Hello, I have a code like that, which has been using by me, but now I need another one, which won't differ a lot, I hope. Please, analize it, I believe that here I'll find somebody with large luggage of experience. Please, write any suggestions you have. Sub test() Dim ws As Worksheet, a, i As Long, ii As Long, b(), n As Long, w(), e With CreateObject("Scripting.Dictionary") For Each ws In Worksheets With...
11
4066
by: Ed Dror | last post by:
Hi there, I'm using ASP.NET 2.0 and SQL Server 2005 with VS 2005 Pro. I have a Price page (my website require login) with GridView with the following columns PriceID, Amount, Approved, CrtdUser and Date And Edit and Delete buttons
3
20830
by: Will | last post by:
Can someone help with code to delete multiple columns from an excel spreadsheet? I know which columns I need to delete. The code below will delete a single column but I'm not sure how to delete multiple columns. I'm tried experimenting with Dim rg As Excel.Range = xlSheet.Columns("B, D, G, K, L") but no joy. Thanks in advance Dim xlApp As Excel.Application Dim xlBook As Excel.Workbook Dim xlSheet As Excel.Worksheet
0
7920
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8054
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8268
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6730
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5867
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5440
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2418
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1510
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1254
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.