Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How can I generate a table in sql from a .txt file?

Posted on 2009-07-06
6
Medium Priority
?
226 Views
Last Modified: 2012-05-07
I have a tab-delimited text file with something like 66 columns/fields from amazon.  I want to generate a table so that I don't have to explicitly define it myself much like I can do in Excel. However, I have created a program that writes an Schema.ini file that already explicity describes the file from which I make an OldDbConnection, OleDbDataAdapter, and subsequently fill into a dataSeta.  So , I believe I have a couple options?  Thanks.
0
Comment
Question by:MotoDev
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 22

Expert Comment

by:8080_Diver
ID: 24790488
First, some questions:
  1. Does the CSV file have column names?
  2. Are the Text columns enclosed in quotes?
  3. Are there any embedded commas in any of the text fields?
While it is possible to do this in a stored proc, I would be tempted to use an application to accomplish this task simply because this is the sort of thing that can be done well and easily in an application and may not be quite as easy in a stored proc.  (Remember, SQL works on sets of data rather than on individual lines/records and, therefore, one has to be able to treat the data asa set. ;-)
0
 

Author Comment

by:MotoDev
ID: 24790616
To answer your questions: Yes, the .txt file has column names in the first or header line, No, there are no quotes. (Ps I hate quotes). Yes, there are commas.

First, some questions: Does the CSV file have column names?  Are the Text columns enclosed in quotes?  Are there any embedded commas in any of the text fields?  And, I failed to mention I do have an application written in VS 2008 C#. Any thoughts...?

While it is possible to do this in a stored proc, I would be tempted to use an application to accomplish this task simply because this is the sort of thing that can be done well and easily in an application and may not be quite as easy in a stored proc.  (Remember, SQL works on sets of data rather than on individual lines/records and, therefore, one has to be able to treat the data asa set. ;-)
0
 

Author Comment

by:MotoDev
ID: 24793600
I found my answer under the title 'Get data from a Dataset into SQL Server 2000'
0
Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

 
LVL 22

Expert Comment

by:8080_Diver
ID: 24800308
To answer your questions: Yes, the .txt file has column names in the first or header line, No, there are no quotes. (Ps I hate quotes). Yes, there are commas.
You may want to be careful, though.  Having a comma in the middle of a text column turns that text column into 2 text columns unless the text is wrapped in qoutes.  (You may hate quotes but they are useful for this sort of thing. ;-)
 
0
 

Author Comment

by:MotoDev
ID: 24803491
I would still like to see it done.
0
 

Accepted Solution

by:
MotoDev earned 0 total points
ID: 24803559
Just to clarify, The text file is Tab-delimited.  And I can pull the dataset(66 fields and data) into datagrid.  Is their a way to create a sql table in C#?
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Progress

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question