Monday, March 12, 2012

Import Data from Excel problem

I got a table which got over 50 fields from an excel files.
Now I can import them into a temp.dbf file . I found that the field type
defined as nvarchar 255.
I use SP to write a insert these data to another real table. (some field is
char20, . 50. 20...etc)
The problem is As I run the insert statment .I will got [String or binary
data would be truncated] <-- error
I don't want to modify the structure of temp.dbf.
Any method that I can ignore That error and import the data ?
Thanks
you can put 'trims' around the fields in your select
look up ltrim and rtrim in BOL
"Agnes" <agnes@.dynamictech.com.hk> wrote in message
news:u43g$QvLFHA.732@.TK2MSFTNGP12.phx.gbl...
>I got a table which got over 50 fields from an excel files.
> Now I can import them into a temp.dbf file . I found that the field type
> defined as nvarchar 255.
> I use SP to write a insert these data to another real table. (some field
> is char20, . 50. 20...etc)
> The problem is As I run the insert statment .I will got [String or binary
> data would be truncated] <-- error
> I don't want to modify the structure of temp.dbf.
> Any method that I can ignore That error and import the data ?
> Thanks
>

No comments:

Post a Comment