Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Importing text file data into single cell

Author  Topic 

kartik306
Starting Member

1 Post

Posted - 2009-01-27 : 06:43:56
Dear experts,

I have a text file containing several lines of data. I want to import this data into a single column of a table so that after import entire content of text file comes in a single cell of the table.
I am trying it through DTS import/export wizard but not getting success.
How can i do this????

karthik_padbanaban
Constraint Violating Yak Guru

263 Posts

Posted - 2009-01-27 : 07:38:45
Check for the character lenght and datatype of the field in which you are inserting.

Karthik
Go to Top of Page

Rajesh Jonnalagadda
Starting Member

45 Posts

Posted - 2009-01-27 : 08:40:28
CREATE TABLE #Temp
(
ColumnName NVARCHAR(Max)
)

DECLARE @FileName NVARCHAR (100)
,@FilePath NVARCHAR (250)
,@Command NVARCHAR(500)

SET @Command = 'BULK INSERT TempTable FROM "'+@FilePath + @FileName + '" WITH(ROWTERMINATOR =''\n'', FIELDTERMINATOR=''\t'')'
EXEC (@Command)


Rajesh Jonnalagadda
http://www.ggktech.com
Go to Top of Page
   

- Advertisement -