Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Administration
 Help - Length of field on import!

Author  Topic 

Bill_C
Constraint Violating Yak Guru

299 Posts

Posted - 2009-11-05 : 05:21:45
Hi All

I'm having import problems with some tables due to sql server setting the length of the fields wrongly.

I seem to remember in the dim and distant past that when importing tables into sql server 2005 that sql server sets the field length based upon the first 'n' records it finds and this figure 'n' is stored somewhere (in registry?) and can be altered for the whole table to be scanned instead.
Anyone tell me where i can find this figure please?

cheers

YellowBug
Aged Yak Warrior

616 Posts

Posted - 2009-11-05 : 06:23:28
Is your source input an Excel file?
How are you importing the data?
Go to Top of Page

Bill_C
Constraint Violating Yak Guru

299 Posts

Posted - 2009-11-05 : 06:35:50
I'm importing using CACHE and get this message:-

Msg 7347, Level 16, State 1, Line 1
OLE DB provider 'MSDASQL' for linked server 'mylinkedserver' returned data that does not match expected data length for column '[MSDASQL].T_DESC'. The (maximum) expected data length is 50, while the returned data length is 55.
Go to Top of Page

YellowBug
Aged Yak Warrior

616 Posts

Posted - 2009-11-05 : 06:45:15
You should create the table definition in SQL Server prior to the data import - this will eliminate the data truncation errors.


Go to Top of Page

Bill_C
Constraint Violating Yak Guru

299 Posts

Posted - 2009-11-05 : 06:57:11
I've tried altering the table spec and re-importing but still get the error. - it's weird!
Go to Top of Page
   

- Advertisement -