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
 SQL Server 2008 Forums
 SSIS and Import/Export (2008)
 Excel source text fields to sql table

Author  Topic 

sarahmfr
Posting Yak Master

214 Posts

Posted - 2011-12-31 : 13:35:57
Hi All,
I have an excel spreadsheet one of the columns is academicperiod it is text and should be 15 characters only
on using dataflow and try to use excel as source and sql table as destination
the academicperiod table field is nvarchar(15)
each time i try to set academicperiod (excel source) to Unicode string [DT_WSTR]15 it automatically changes to 255 and then I get an error that source and destination for academicperiod do not match
how can i set max length of text field in excel to set it to only 15 characters
Thanks

sarah

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-01-01 : 02:25:39
you can use derived column task for that use like

([DT_WSTR],15) sourcefield



------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

sarahmfr
Posting Yak Master

214 Posts

Posted - 2012-01-02 : 10:44:04
Thanks I will try that

sarah
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-01-02 : 11:59:37
wc
let me know how you got on

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

sarahmfr
Posting Yak Master

214 Posts

Posted - 2012-01-02 : 12:31:49
Thanks a lot it worked

sarah
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-01-02 : 12:34:54
wc

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -