Re: Bulk Insert Question

From: sqlnewbie (1_at_1.com)
Date: 02/25/05


Date: Fri, 25 Feb 2005 16:53:06 -0500

thanks, I'll play around with it...

"Hugo Kornelis" <hugo@pe_NO_rFact.in_SPAM_fo> wrote in message
news:g77v11dgleakllnsplfl2aacookufkbcum@4ax.com...
> On Fri, 25 Feb 2005 16:13:13 -0500, sqlnewbie wrote:
>
>>I need to move some data from an ascii file to a database. I want to use
>>BULK INSERT. The problem I have is there is no field seperation in the
>>ascii file. For example, columns 1-5 constitute a number, 6-28 constitute
>>a
>>description, etc. Is there a way to use BULK INSERT without having to put
>>a
>>comma or something between each field of data. Below is a small example
>>of
>>data :
>>
>>item description cost retail
>>12345thisistheitemdescription00245903599
>>
>
> Hi sqlnewbie,
>
> I think you can do this with a formatfile. The easiest way to do this,
> is to first run the bcp utility from a DOS prompt, answering all
> questions and saving the information in a format file. Then, use a text
> editor to check the contents of the format file and tweak it as needed.
> Finally, use the FORMATFILE option of the BULK INSERT to specify this
> format file for your date import.
>
> Check out the subjects "bcp Utility (overview)" and "Using Format Files"
> in Books Online for more information.
>
> Best, Hugo
> --
>
> (Remove _NO_ and _SPAM_ to get my e-mail address)



Relevant Pages

  • Re: Bulk Insert
    ... and the error message says: ... Error: Bulk Insert fails. ... file with comma as field delimiter, and quotes are obviously not part ... A format file for the above would look ...
    (microsoft.public.sqlserver.tools)
  • Re: Bulk Insert Question
    ... >BULK INSERT. ... The problem I have is there is no field seperation in the ... questions and saving the information in a format file. ... editor to check the contents of the format file and tweak it as needed. ...
    (microsoft.public.sqlserver.programming)
  • Re: Simple Bulk Insert
    ... We can use DTS for that. ... But I was looking for any Support in Bulk Insert. ... I think We can Do that using "Format File". ...
    (microsoft.public.sqlserver.server)
  • Re: Simple Bulk Insert
    ... We can use DTS for that. ... But I was looking for any Support in Bulk Insert. ... I think We can Do that using "Format File". ...
    (microsoft.public.sqlserver.programming)
  • RE: How to import fixed-width text file in MS SQL 2000?
    ... Bulk insert with a format file? ... Bulk insert with a staging table? ... column sizes to match the file. ... > thing there about importing fixed-width text file. ...
    (microsoft.public.sqlserver.clients)