Hi,
I'm trying to use bulk insert to import a unformated text file into a table
with 6 columns using the following code in query analyzer:
BULK INSERT tblLocalizerTemp from 'c:\temp\textfile.txt'
WITH (CODEPAGE='RAW', ROWTERMINATOR='\n')
Since I don't have column delimiters, I left out FIELDTERMINATOR but I'm
getting an error saying that the column from the text file is too long. How
can I specify how this gets imported. The docs are not very helpful. Also,
is there a way to just import specific bytes of the file into the table
without having to import the whole record.
ThanksI got this to work with the following but now I'm having trouble using a
variable to use may my path information. I want to eventually call a stored
proc from a VB6 app
declare @.cLocalizerPath varchar(100)
declare @.cFmtPath varchar(100)
select @.cLocalizerPath = 'c:\temp\temp.txt'
select @.cFmtPath = 'c:\temp\temp.fmt'
BULK INSERT tblLocalizerTemp from @.cLocalizerPath
WITH (CODEPAGE='RAW', FORMATFILE=@.cFmtPath)
"Ellie" <nospam@.nospam.net> wrote in message
news:OsWLJZjPGHA.420@.tk2msftngp13.phx.gbl...
> Hi,
> I'm trying to use bulk insert to import a unformated text file into a
> table with 6 columns using the following code in query analyzer:
> BULK INSERT tblLocalizerTemp from 'c:\temp\textfile.txt'
> WITH (CODEPAGE='RAW', ROWTERMINATOR='\n')
> Since I don't have column delimiters, I left out FIELDTERMINATOR but I'm
> getting an error saying that the column from the text file is too long.
> How can I specify how this gets imported. The docs are not very helpful.
> Also, is there a way to just import specific bytes of the file into the
> table without having to import the whole record.
> Thanks
>
No comments:
Post a Comment