Solved

how to import

Posted on 2016-10-01
7
69 Views
Last Modified: 2016-10-28
How do i import a text file into sql server 2008?  do I need to create the destination table first?  The record size is 2513.  there maybe 4500 records.  Thank you.
0
Comment
Question by:shwelopo
[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
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 13

Expert Comment

by:Nakul Vachhrajani
ID: 41824761
I would start by determining whether this is a one-time activity or a repeating one?

If it's a one-time activity, I would suggest using the Import & Export Data Utility wizard (Start -> All Programs -> Microsoft SQL Server -> Import and Export Data Utility) to import the data.

If it's a repeating activity, the ideal choice would be to create a SSIS package or use the BCP/Bulk insert strategy.

In both cases, my recommendation would be to create the destination table beforehand since that would give you the maximum control on the table design.
0
 
LVL 28

Accepted Solution

by:
Pawan Kumar earned 500 total points
ID: 41824809
Try something like..

CREATE TABLE testCSV
(
	 Name NVARCHAR(1000)
	,Disponibilidade NVARCHAR(1000)
	,Data NVARCHAR(1000)
	,Report NVARCHAR(1000)
	,Country NVARCHAR(1000)
	,Last_refresh NVARCHAR(1000)
)
GO

BULK
INSERT testCSV
FROM 'E:\Pawan1.CSV'
WITH
(
FIELDTERMINATOR = ';',
ROWTERMINATOR = '|'
)
GO

SELECT * FROM testCSV

Open in new window

0
 
LVL 28

Expert Comment

by:Pawan Kumar
ID: 41826261
@Author - Can you send me the text file, I shall create a small script for you..
0
Edgartown IT Case Study

Learn about Edgartown's quest to ensure the safety and security of the entire town's employee and citizen data. Read the case study!

 
LVL 49

Expert Comment

by:Vitor Montalvão
ID: 41827665
What's the goal of this operation?
Nakul's comment is very good. It will be also good if you could give some feedback.
0
 

Author Comment

by:shwelopo
ID: 41836822
thanks
0
 
LVL 49

Expert Comment

by:Vitor Montalvão
ID: 41857050
shwelopo, if your question has been answered please mark the comment or comments that helped you so this question can be closed.
0
 

Author Closing Comment

by:shwelopo
ID: 41863936
thank you
0

Featured Post

Edgartown IT Case Study

Learn about Edgartown's quest to ensure the safety and security of the entire town's employee and citizen data. Read the case study!

Question has a verified solution.

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

Suggested Solutions

JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties

756 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