BCP error

  • Not sure quite where to post this since it is BCP rather than DTS.  I have a BCP export that has been working fine for quite some time.  It runs once a day.  Today the file has a bunch of charactors that kind of look like a zero (sort of a boxey looking thing). 

    The export is pulling data from a Stored Procedure query.  If I look at the results in query manager it looks fine.

    I manually ran the process, and was able to duplicate the error.  The really weird thing is that I though it might relate to a bad charactor in one of the rows of data so I added an IN clause to the sp that idenitified each of the 13 rows.  I sarted to comment out some of the items so the row would not apprear in the results.  It seems that the error only occurs when 9 specific rows are in the result set.  Comment out any of these 9 and the output looks correct.  the other 4 rows don't seem to have any effect.

    Any ideas?  It really has me baffled.  I suspected that when it runs tommorow everything will be fine since it seems to depend on a very specific set of data to cause the error.

     

  • Well I finally figured this out.  I am using the Queryout option in BCP to run an sp.  It turns out the problem was caused by a case statement in the sp that either returned a varchar or just Null.  This apprently causes BCP to get confused about what type the data is and to export garbage.  I just swtiched the code around slightly to do the case statement first and then convert the entire result to a varchar and all is well

Viewing 2 posts - 1 through 1 (of 1 total)

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