Problem BCP (Format File) with NULL Fields

  • Hi,

    I am trying to BCP out a table which has new NULL values for some fields. I need to get all the data in a flatfile from a table. If any rows contain NULL values, I want to fill with spaces. So that this flat file can be used with positional file (similar to format file) as an input to another system. This system processcess this file based on the position of the data.

    Please help...

    .

  • One way is to specify a select statement and for the character based columns use IsNull(Col1,Space(10)).

  • Thanks Len. But in SQL Server 6.5, we don't have query option. I am trying from a client which has SQL 2000 BCP utility.

    .

  • Rather than trying a fixed length type of file why don't you try a delimited file? That way you should be able to just export the nulls and then handle them on the import. Otherwise you coult transform the data into an "Export" table prior to running BCP.

    Gary Johnson

    Microsoft Natural Language Group

    DBA, Sr. DB Engineer




    Gary Johnson
    Microsoft Natural Language Group
    DBA, Sr. DB Engineer

    This posting is provided "AS IS" with no warranties, and confers no rights. The opinions expressed in this post are my own and may not reflect that of my employer.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply