Solved

how to import

Posted on 2016-10-01
7
73 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 14

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 29

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 29

Expert Comment

by:Pawan Kumar
ID: 41826261
@Author - Can you send me the text file, I shall create a small script for you..
0
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 
LVL 51

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 51

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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
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 combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.

617 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