To continue reading for free, register below or login
To read more you must become a member of SearchSQLServer.com
');
// -->

There are many ways to import data into SQL Server and what you choose depends greatly on your specific scenario. If you want to simply load contents of a text file into a temporary table, the BULK INSERT command should do the trick. If the number and the order of the columns in the file is the same as in the destination table, your statement could be as simple as this:
BULK INSERT MyTable
FROM 'c:datamydata.txt'
WITH
(
FIELDTERMINATOR =' |',
ROWTERMINATOR =' |\n'
)
If you want to exclude some columns or modify the order of columns, create a format file and specify it as a parameter to BULK INSERT. You can refer to Books Online to learn more about how to use BULK INSERT and how to create a format file.
|