[Wlug] Any SQL-types out there? (more lab automation stuff)
Stephen Daukas
scd at daukas.com
Wed Jul 25 13:32:30 EDT 2007
I received an incredibly useful suggestion from a fellow WLUGger that I am
coming up to speed on. I'll fill you in when I'm confident I "get" what he
is trying to "learn me". Its probably "SQL 101" for database types, but
I'll provide a summary of what I end up with just the same. Definitely a
SQL solution!
Steve
On 7/25/07, Stephen Daukas <scd at daukas.com> wrote:
>
> Hi Chuck!
>
> If I knew the order of the columns a priori, that would work, but sadly I
> don't. The number of columns, as well as the order, are random due to the
> fact that different sondes collect different data. In fact, my plan was to
> first determine the order of the columns in the source file, then I thought
> about using ALTER TABLE (in combination with SELECT column-of-interest) to
> put each column, one-by-one, into the new table in the proper order - last
> to first. If I select columns as you suggest, I still have to insert
> "empty" columns to maintain the proper column order, and I haven't found a
> way to insert a column into the middle of a table. (ALTER TABLE always
> creates a new column at the front of the table.)
>
> I was also thinking of biting the bullet and learning about MS JET (ODBC
> provider) attributes/field names as a way of discovering what fields
> (columns) are available, but I'm trying to keep this as close to "token
> handling" as possible so I can easily cleave MS-specific file stuff from the
> meat of the program.
>
> Correct me if I'm wrong on this - my SQL experience is on the order of 15
> years old and I only just taught myself VB scrpt a few weeks ago...
>
> Steve
>
> On 7/25/07, Chuck Anderson <cra at wpi.edu> wrote:
> >
> > On Wed, Jul 25, 2007 at 09:29:43AM -0400, Stephen Daukas wrote:
> > > There are literally hundreds of files of data in CSV format, and I
> > intend to
> > > process each by itself, preserving the original, and creating a new
> > > "adjusted" file for the next step. (The next step would be to
> > concatenate
> > > all files together for numeric processing.) Original files must be
> > > preserved (chain of custody requirements), so I am opening the file,
> > > selecting records using SQL, and am now ready to do the
> > rearranging/writing
> > > to a new file...
> >
> > So you are selecting records out of a CSV file using SQL? How about
> > this:
> >
> > select columnB,columnG,columnA,columnC,columnF from foo;
> >
> > That will take the columns and return them in the given order.
> > _______________________________________________
> > Wlug mailing list
> > Wlug at mail.wlug.org
> > http://mail.wlug.org/mailman/listinfo/wlug
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.wlug.org/pipermail/wlug/attachments/20070725/a612067e/attachment.html
More information about the Wlug
mailing list