How to read data file into SQL tables

How to read data file into SQL tables

Question:
I’m curious to know, if I have a file full of data separated by commas, how do I read stuff from that file into SQL tables?

Answer:
The fastest way to get it into tables is to use BCP (MSSQL 6.5), (Or if you have SQL 7, the DTS).

BCP will let you specify separators and delimiters as well as other characteristics about the job, but it is a command line interface that isn’t fun. I have found that it is best to import your data into SQLCHAR columns in staging tables. Once you have succesfully imported the data into the server, you can use the built in functions to massage your data into its correct datatypes and into its proper target table.

DTS on the other hand, is much more fun, if a little slower. It has many more options to condition the data during import/export.

Share the Post:
Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular

XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved

AI is revolutionizing fraud detection

How AI is Revolutionizing Fraud Detection

Artificial intelligence – commonly known as AI – means a form of technology with multiple uses. As a result, it has become extremely valuable to a number of businesses across

AI innovation

Companies Leading AI Innovation in 2023

Artificial intelligence (AI) has been transforming industries and revolutionizing business operations. AI’s potential to enhance efficiency and productivity has become crucial to many businesses. As we move into 2023, several