Subject RE: [firebird-support] Re: Problem in Bulk Insertion in Firebird
Author Alan McDonald
> Dear Alan,
> > I suppose you realise that external files need to be fixed field
> length char
> > files only?
> Yes i know that, i dumped my things into file like this:
> each line in my file consists of char[19+256]
> 19 for LONG value and 256 for CHAR(256)
>
> > You are talking about \0 (nulls) - I don't suppose you are imagining
> that
> > any old file format is suitable to use as an external file?
> No, i havent used any old format of file.
> Those nulls were all due to this:
> Here is a snippit of my code.
> long value=10;
> string key="this is firebird forum";
> not to dump this in my file
> i did it like this:
>
> char[] totalArray = new char[266];
> value.ToString().ToCharArray().CopyTo(totalArray, 0);
> char[] word = p.changeToASCII(files[i]);
> word.CopyTo(totalArray, 10);
> documentWriter.WriteLine(totalArray);
>
> so there will be null chars present in the unfilled section of char array.
> Like this i dumped in the file and then used as EXTERNAL FILE.
>
> Hey i even dont know if i'm doing it all right or not..
> Please do help me..

you're in total control the dump file so don't put nulls in there. Left pad
the numbers with spaces. Right pad the strings with spaces. Then FB will
read it all with no need for conversion.
Alan