Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Question about SQL from a beginner

Status
Not open for further replies.

dieselBREATH

Technical User
Mar 14, 2001
48
US
SQL is new to me, but I have need to use it I think.

I have data that is in the form of an access data base. Can I use SQL to retrieve certain data, and manipulate and export that data in the form of a comma delimeted asci text file? In addition, can I insert information like extra comas (representing blank feilds) or default values? Here is an example:

Data Base

f_name L_name user_ID job qty date

John Doe 232 12345 10 08/23/01
Jane Doe 233 78910 28 08/27/01
Sid Martin 111 99999 33 08/28/01


Result:

08/23/01,232,,,default,, 12345,1-plot,,10
08/27/01,233,,,default,, 78910,1-plot,,28
08/28/01,111,,,default,, 99999,1-plot,,33


So, is this possible? If so, where would be a good place for a beginner to learn to do this? Obviously, I have an important project that I need this for. I have a month to complete this starting from 8/1/2001. Thanks to everyone who will help!

Diesel Breath
balbaugh@columbus.rr.com
 

Create a query in the query designer. Select each column for output. In the columns where you want no output or empty strings, place "" in the field name. Access will add names like Expr1, Expr2, etc. Save the query. Export from the query to the text file in csv format.

By default, Access will use " to delimit text strings. All the empty strings will have "" so your output will be

08/28/01,111,"","",default,"", 99999,1-plot,"",33

rather than the format you specified. If you have no embedded spaces in the output, you can specify no text delimiter in the advanced specifications for the export. Save the export specification and use it whenever exporting the data. Terry L. Broadbent
faq183-874 contains some tips and ideas for posting questions in these forums. Please review it if you have time.
 
Thank you Terry!

Just a couple of things. (this should show my lack of knowledge on the subject real quick)

In my example text export, you see the field 1-plot. This is not in any column or table of the access database. It is simply data that is required in the final destination software therefore I have to provide it. Is this possible?
Also, can I change the order of the fields so that when I export them, they are in the order that is required?

By the way, I am scanning FAQ's also. I am in a hurry and I am trying all avenues for help. I greatly appreciate yours!

Bill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top