Urgent help with bcp

  • Dear Friends,

    This is the requirement. I have taken bcpout by using raw parameter and convert this to UCS-2 format and back doing bcpin with -w to support UTF-8 underdifferent collations.

    When i am doing bcpin , i am getting error with only one table as, SQLState = 22005, NativeError = 0

    Error = [Microsoft][ODBC SQL Server Driver]Invalid character value for cast specification

    What will be the problem here? how can i come out from this error?

    i have done soemthing like creating a view and bcp in but not working out.. could anyone help me out in this.

    Thanks,

  • Just a thought.  If you are using two different Databases.  Script out the two tables and make sure the schema is identical. I had a problem like this and that was the cause.   


    Mike Mullins

  • Example:

     

    Script 1

    CREATE TABLE [dbo].[test] (

     [field1] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,

     [field2] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,

     [field3] [char] (2) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,

     [field4] [char] (2) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,

     [field5] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL

    ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

    GO

    Script 2

    ****** OLD SCRIPT  - Get Error on ) *******

    CREATE TABLE [dbo].[test] (

     [field1] [varchar] (50)  NOT NULL ,

     [field2] [varchar] (255)  NOT NULL ,

     [field3] [char] (2)  NOT NULL ,

     [field4] [char] (2)  NOT NULL ,

     [field5] [text] COLLATE  NOT NULL

    ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

    GO


    Mike Mullins

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

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