-
Exporting specific fields from tables
Hi,
I know how to export whole tables as follows...
'Export This Table
strTable = "tblthis"
strSql = "SELECT " & strTable & ".* INTO " & strTable & " IN """ &
conFile & """ FROM " & strTable & ";"
dbLocal.Execute strSql, dbFailOnError
strMsg = strMsg & dbLocal.RecordsAffected & " " & strTable & "
record(s)" & vbCrLf
'Export That Table
strTable = "tblthat"
strSql = "SELECT " & strTable & ".* INTO " & strTable & " IN """ &
conFile & """ FROM " & strTable & ";"
dbLocal.Execute strSql, dbFailOnError
strMsg = strMsg & dbLocal.RecordsAffected & " " & strTable & "
record(s)" & vbCrLf
....but I would like to know how to export specific fields from each
table, not just the whole table ?
Has anyone had any experience with doing that kind of thing?
EMBC
-
Re: Exporting specific fields from tables
eyemustbecrazy@hotmail.com wrote in
news:0e250d21-9cc9-4bd7-8447-
82e09ddfb03e@m34g2000hsf.googlegroups.co
m:
>
> Hi,
>
> I know how to export whole tables as follows...
>
>
>
> 'Export This Table
>
> strTable = "tblthis"
> strSql = "SELECT " & strTable & ".* INTO " & strTable & " IN
> """ &
> conFile & """ FROM " & strTable & ";"
> dbLocal.Execute strSql, dbFailOnError
> strMsg = strMsg & dbLocal.RecordsAffected & " " & strTable & "
> record(s)" & vbCrLf
>
> 'Export That Table
>
> strTable = "tblthat"
> strSql = "SELECT " & strTable & ".* INTO " & strTable & " IN
> """ &
> conFile & """ FROM " & strTable & ";"
> dbLocal.Execute strSql, dbFailOnError
> strMsg = strMsg & dbLocal.RecordsAffected & " " & strTable & "
> record(s)" & vbCrLf
>
>
>
> ...but I would like to know how to export specific fields from
> each table, not just the whole table ?
>
> Has anyone had any experience with doing that kind of thing?
>
> EMBC
>
By fields, do you mean columns?
If you do, than all you need to do is modify the SELECT statement
to specify which columns you want.
e.g.
strSql = "SELECT column1, ID, [field 7], [field 11] INTO "
where you substitute the field names you desire as a comma separated
list instead of your wildcard (*) that selects all the columns.
If you mean rows, add a WHERE clause to the query to select those
rows that meet your needs.
--
Bob Quintal
PA is y I've altered my email address.
--
Posted via a free Usenet account from http://www.teranews.com
-
Re: Exporting specific fields from tables
On 02 Feb 2008 11:38:27 GMT, Bob Quintal
wrote:
>eyemustbecrazy@hotmail.com wrote in
>news:0e250d21-9cc9-4bd7-8447-
>82e09ddfb03e@m34g2000hsf.googlegroups.co
>m:
>
>>
>> Hi,
>>
>> I know how to export whole tables as follows...
>>
>>
>>
>> 'Export This Table
>>
>> strTable = "tblthis"
>> strSql = "SELECT " & strTable & ".* INTO " & strTable & " IN
>> """ &
>> conFile & """ FROM " & strTable & ";"
>> dbLocal.Execute strSql, dbFailOnError
>> strMsg = strMsg & dbLocal.RecordsAffected & " " & strTable & "
>> record(s)" & vbCrLf
>>
>> 'Export That Table
>>
>> strTable = "tblthat"
>> strSql = "SELECT " & strTable & ".* INTO " & strTable & " IN
>> """ &
>> conFile & """ FROM " & strTable & ";"
>> dbLocal.Execute strSql, dbFailOnError
>> strMsg = strMsg & dbLocal.RecordsAffected & " " & strTable & "
>> record(s)" & vbCrLf
>>
>>
>>
>> ...but I would like to know how to export specific fields from
>> each table, not just the whole table ?
>>
>> Has anyone had any experience with doing that kind of thing?
>>
>> EMBC
>>
>By fields, do you mean columns?
>
>If you do, than all you need to do is modify the SELECT statement
>to specify which columns you want.
>e.g.
>strSql = "SELECT column1, ID, [field 7], [field 11] INTO "
>where you substitute the field names you desire as a comma separated
>list instead of your wildcard (*) that selects all the columns.
>
>If you mean rows, add a WHERE clause to the query to select those
>rows that meet your needs.
>
>--
>Bob Quintal
>
>PA is y I've altered my email address.
Also, don't forget - if you want help with the syntax, the Query
Builder will create the SQL for you. Thesis would include choosing
which fields go into which table in which database.
Arch
-
Re: Exporting specific fields from tables
On Feb 3, 1:32*am, Arch wrote:
> On 02 Feb 2008 11:38:27 GMT, Bob Quintal
> wrote:
>
>
>
>
>
> >eyemustbecr...@hotmail.com wrote in
> >news:0e250d21-9cc9-4bd7-8447-
> >82e09ddfb...@m34g2000hsf.googlegroups.co
> >m:
>
> >> Hi,
>
> >> I know how to export whole tables as follows...
>
> >>
>
> >> * *'Export This Table
>
> >> * * strTable = "tblthis"
> >> * * strSql = "SELECT " & strTable & ".* INTO " & strTable & " IN
> >> * * """ &
> >> conFile & """ FROM " & strTable & ";"
> >> * * dbLocal.Execute strSql, dbFailOnError
> >> * * strMsg = strMsg & dbLocal.RecordsAffected & " " & strTable & "
> >> record(s)" & vbCrLf
>
> >> * * 'Export That Table
>
> >> * * strTable = "tblthat"
> >> * * strSql = "SELECT " & strTable & ".* INTO " & strTable & " IN
> >> * * """ &
> >> conFile & """ FROM " & strTable & ";"
> >> * * dbLocal.Execute strSql, dbFailOnError
> >> * * strMsg = strMsg & dbLocal.RecordsAffected & " " & strTable & "
> >> record(s)" & vbCrLf
>
> >>
>
> >> ...but I would like to know how to export specific fields from
> >> each table, not just the whole table ?
>
> >> Has anyone had any experience with doing that kind of thing?
>
> >> EMBC
>
> >By fields, do you mean columns?
>
> >If you do, than all you need to do is modify the SELECT statement
> >to specify which columns you want. *
> >e.g.
> >strSql = "SELECT column1, ID, [field 7], [field 11] INTO "
> >where you substitute the field names you desire as a comma separated
> >list instead of your wildcard (*) that selects all the columns.
>
> >If you mean rows, add a WHERE clause to the query to select those
> >rows that meet your needs.
>
> >--
> >Bob Quintal
>
> >PA is y I've altered my email address.
>
> Also, don't forget - if you want help with the syntax, the Query
> Builder will create the SQL for you. Thesis would include choosing
> which fields go into which table in which database.
>
> Arch- Hide quoted text -
>
> - Show quoted text -
Yes Bob, columns not fields......I shouldn't try new coffee
unsupervised.
Thanks
EMBC
-
Re: Exporting specific fields from tables
On Feb 3, 8:58*am, eyemustbecr...@hotmail.com wrote:
> On Feb 3, 1:32*am, Arch wrote:
>
>
>
>
>
> > On 02 Feb 2008 11:38:27 GMT, Bob Quintal
> > wrote:
>
> > >eyemustbecr...@hotmail.com wrote in
> > >news:0e250d21-9cc9-4bd7-8447-
> > >82e09ddfb...@m34g2000hsf.googlegroups.co
> > >m:
>
> > >> Hi,
>
> > >> I know how to export whole tables as follows...
>
> > >>
>
> > >> * *'Export This Table
>
> > >> * * strTable = "tblthis"
> > >> * * strSql = "SELECT " & strTable & ".* INTO " & strTable & " IN
> > >> * * """ &
> > >> conFile & """ FROM " & strTable & ";"
> > >> * * dbLocal.Execute strSql, dbFailOnError
> > >> * * strMsg = strMsg & dbLocal.RecordsAffected & " " & strTable & "
> > >> record(s)" & vbCrLf
>
> > >> * * 'Export That Table
>
> > >> * * strTable = "tblthat"
> > >> * * strSql = "SELECT " & strTable & ".* INTO " & strTable & " IN
> > >> * * """ &
> > >> conFile & """ FROM " & strTable & ";"
> > >> * * dbLocal.Execute strSql, dbFailOnError
> > >> * * strMsg = strMsg & dbLocal.RecordsAffected & " " & strTable & "
> > >> record(s)" & vbCrLf
>
> > >>
>
> > >> ...but I would like to know how to export specific fields from
> > >> each table, not just the whole table ?
>
> > >> Has anyone had any experience with doing that kind of thing?
>
> > >> EMBC
>
> > >By fields, do you mean columns?
>
> > >If you do, than all you need to do is modify the SELECT statement
> > >to specify which columns you want. *
> > >e.g.
> > >strSql = "SELECT column1, ID, [field 7], [field 11] INTO "
> > >where you substitute the field names you desire as a comma separated
> > >list instead of your wildcard (*) that selects all the columns.
>
> > >If you mean rows, add a WHERE clause to the query to select those
> > >rows that meet your needs.
>
> > >--
> > >Bob Quintal
>
> > >PA is y I've altered my email address.
>
> > Also, don't forget - if you want help with the syntax, the Query
> > Builder will create the SQL for you. Thesis would include choosing
> > which fields go into which table in which database.
>
> > Arch- Hide quoted text -
>
> > - Show quoted text -
>
> Yes Bob, columns not fields......I shouldn't try new coffee
> unsupervised.
>
> Thanks
>
> EMBC- Hide quoted text -
>
> - Show quoted text -
Off topic - how do I edit the username in groups??
The email doesnt work for me!
EMBC